Submission #1108267

#TimeUsernameProblemLanguageResultExecution timeMemory
1108267akzytrUnscrambling a Messy Bug (IOI16_messy)C++17
0 / 100
2 ms508 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
#define ve vector
#define sz(a) ((int)(a).size())

void add_element(std::string x);
bool check_element(std::string x);
void compile_set();

ve<int> restore_permutation(int n, int w, int r) {
	ve<int> p(n);
	string x = "";
	for(int i = 0; i < n; i++) {
		x += '0';
	}

	for(int i = 0; i < n; i++) {
		x[i] = '1';
		add_element(x);
	}

	compile_set();
	x = "";
	for(int i = 0; i < n; i++) {
		x += '0';
	}
	for(int i = 0; i < n; i++) {
		p[i] = n - 1;
		for(int j = 0; j < n - 1; j++) {
			if(x[j] != '1') {
				x[j] = '1';
				if(check_element(x)) {
					p[i] = j;
					break;
				}
				x[j] = '0';
			}
		}
	}

	return p;
}

/*
How to make better use of the writes?

[0,1,2,3]

1 1 0 0

0 0 1 1


*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...