제출 #69200

#제출 시각아이디문제언어결과실행 시간메모리
69200SmsSUnscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
4 ms768 KiB
#include<bits/stdc++.h>
using namespace std;
#define for2(a,b,c) for(int a=b;a<c;a++)

#include "messy.h"
int n;

string get(int i,int j){
	string res;
	for2(i,0,n) res += "0";
	res[i] = res[j] = '1';
	return res;
}

vector<int> restore_permutation(int N, int w, int r) {
	n = N;
	string s;
	for2(i,0,n) s += "0";
	for2(i,0,7){
		s[i] = '1';
		add_element(s);
	}
	for2(j,0,7) for2(i,7,n)if(i&(1<<j)) add_element(get(j,i));
    compile_set();
	vector<int> p(n,-1);
	vector<int> rnd(n);
	srand(10);
	for2(i,0,n) rnd[i] = i;
	for2(i,0,n) s[i] = '0';
	int X[7];
	for2(i,0,7){
		random_shuffle(rnd.begin(),rnd.end());
		for(auto x : rnd) if(s[x] != '1'){
			s[x] = '1';
			if(check_element(s)){
				p[x] = i;
				X[i] = x;
				break;
			}
			s[x] = '0';
		}
	}
	for2(i,0,7){
		for2(j,7,n) if(check_element(get(X[i],j))){
			p[j] |= (1<<i);
		}
	}
    return p;
}
#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...