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>
#include "messy.h"
#define pb push_back
using namespace std;
std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
#define all(x) begin(x), end(x)
vector<int> restore_permutation(int n, int w, int r) {
string curr;
for(int i = 0; i < n; i++) curr.pb('1');
for(int i = 0; i < n; i++){
curr[i] = '0';
add_element(curr);
}
compile_set();
set<int> caras;
vector<int> p(n);
for(int i = 0; i < n; i++){
string aux;
for(int j = 0; j < n; j++){
if(caras.count(j))aux.pb('0');
else aux.pb('1');
}
vector<int> pos;
for(int j=0;j<n;j++)pos.pb(j);
shuffle(all(pos), rng);
for(auto j: pos){
if(aux[j] == '1'){
string P = aux;
P[j] = '0';
if(check_element(P)){
caras.insert(j);
// p[i]=j;
p[j]=i;
break;
}
}
}
}
// for(int i = 0; i < n; i++) cout<<p[i]<<" ";
// cout<<"\n";
return p;
}
# | 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... |