Submission #922372

#TimeUsernameProblemLanguageResultExecution timeMemory
922372ByeWorldUnscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
1 ms500 KiB
#include <vector>
#include <bits/stdc++.h>
#define bupol __builtin_popcount
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
const int MAXN = 1e3+5;
const int MAXK = 205;
const int LOG = 20;
const int MOD = 1e9+7;
const int SQRT = 520;
const ll INF = 1e18+10;
typedef pair<int,int> pii;
typedef pair<pii,int> ipii;
#include "messy.h"

int n;
vector <int> vec;
void ADD(){
	string s = "";
	for(int i=0; i<n; i++) s += '1';
	add_element(s);
	for(int i=n-1; i>=1; i--){
		s[i] = '0';
		//cout << s << " oo\n";
		add_element(s);
	}
}
void CHECK(){
	string s;
	for(int i=0; i<n; i++) s += '0';
	for(int i=0; i<n; i++){ // check yg i (0)
		for(int j=0; j<n; j++){ // j='1', i+1->n-1 = '0'
			if(vec[j] != -1) continue;
			s[j] = '1';
			//cout << s << " p\n";
			if(check_element(s)){
				//cout << s << ' ' << j << ' ' << i << " xx\n";
				vec[j] = i;
				break;
			} else {
				s[j] = '0';
			}
		}
	}
	check_element(s);
}

vector<int> restore_permutation(int N, int w, int r) {
	n = N; vec.resize(n);
	for(int i=0; i<n; i++) vec[i] = -1;

	ADD();
    compile_set();
    CHECK();

    return vec;
}
#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...