This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll>;
template<typename T>
using matrix = vector<vector<T>>;
const int INF =(1<<30)-1;
const ll INFL = (1ll<<61)-1;
#include "messy.h"
const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count();
std::vector<int> restore_permutation(int n, int w, int r) {
for(int i = 0; i < n; i++){
string s(n,'0');
fill(s.begin(),s.begin()+i+1,'1');
add_element(s);
}
compile_set();
vector<int> resp(n);
string quest(n,'0');
vector<int> perm(n);
iota(all(perm),0);
mt19937 rng(RANDOM);
for(int i = 0; i < n; i++){
shuffle(all(perm),rng);
for(int j = 0; j < n; j++){
int id = perm[j];
if(quest[id]!='1'){
quest[id] = '1';
bool ret = check_element(quest);
if(ret){
resp[id] = i;
break;
}
quest[id] = '0';
}
}
}
return resp;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |