CSES - Datatähti 2023 alku - Results
Submission details
Task:Lista
Sender:Laserr
Submission time:2022-11-13 11:53:40 +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<int> syote(100);
vector<int> lista(2023, 0);
set<int> loput_luvut;

int mika;

vector<int> v;
vector<int> p(2024, 0);
int summa;
bool loytynyt;

void haku() {
	if (loytynyt == true) return;
	if (summa > mika) return;
	if (v.size() > 43) return;

	if (summa == mika && v.size() == 43) {
		for (int i = 0; i < 43; i++) {
			lista[i] = v[i];
			loput_luvut.insert(v[i]);
		}
		loytynyt = true;
	}
	else {
		for (int i = 1; i <= 2023; i++) {
			if (p[i] == 1) continue;

			p[i] = 1;
			summa += i;
			v.push_back(i);

			haku();

			p[i] = 0;
			summa -= i;
			v.pop_back();
		}
	}
}

int main() {
	//mika = 0;
	summa = 0;
	loytynyt = false;

	for (int i = 0; i < 100; i++) cin >> syote[i];
	mika = syote[0];

	haku();

	for (int i = 0; i < 2023; i++) {
		if (lista[i] > 0) continue;
		for (int j = 1; j <= 2023; j++) {
			if (loput_luvut.count(j) == 0) {
				lista[i] = j;
				loput_luvut.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;
...