CSES - Datatähti 2023 alku - Results
Submission details
Task:Lista
Sender:Laserr
Submission time:2022-11-12 20:42:50 +0200
Language:text (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#10.00 s0details

Code

#include<iostream>
#include<vector>
#include<set>

using namespace std;

vector<pair<int, int>> syote;
vector<int> lista(2023, 0); //tulostettava lista
set<int> ll; //jaljella olevat luvut
int kasitellyt_luvut = 0; 


vector<int> valiaika; //valiaikainen lista johon tallentetaan luvut
int summa = 0; //valiaikaine haussa kaytettava summa
int mika = 0;
int tavoite = 0;
bool loytynyt = false;


void haku(int k) {
	if (valiaika.size() == 43) {
		if (summa == syote[mika].first && loytynyt == false) {
			for (int i = 0; i < valiaika.size(); i++) {
				lista[i] = valiaika[i];
				kasitellyt_luvut++;
			}
			loytynyt = true;
		}
	}
	if (k == 2023) {
		return;
	}
	else {
		haku(k+1);

		valiaika.push_back(k);
		summa += k + 1;
		haku(k + 1);
		summa -= k + 1;
		valiaika.pop_back();
	}
}

int main() {
	for (int i = 1; i <= 2023; i++)ll.insert(i);
	for (int i = 0; i < 100; i++) {
		int x;
		cin >> x;
		syote.push_back({ x, i });
	}

	haku(1);
	/*for (int i = 0; i < 100; i++) {
		mika = i;
		tavoite = syote[i].first + 1;
		haku(1);
	}*/

	for (int i = kasitellyt_luvut; i <= 2023; i++) {
		for (int j = 1; j <= 2023; j++) {
			if (ll.count(j) == 0) {
				lista[i] == j;
				ll.insert(j);
				break;
			}
		}
	}

	for (int i : lista) cout << i << " ";
}

Test details

Test 1

Verdict:

input
58667 68283 64141 69169 67564 ...

correct output
688 488 1060 602 1171 471 322 ...

user output
#include<iostream>
#include<vector>
#include<set>

using namespace std;
...