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 <vector>
#include <bits/stdc++.h>
using namespace std;
#include "messy.h"
mt19937 engine(time(NULL));
std::vector<int> restore_permutation(int n, int w, int r){
string s="";
for(int i=0; i<n; i++){
s=s+'1';
string q="";
for(int j=0; j<n-i-1; j++){
q=q+'0';
}
q=q+s;
add_element(q);
}
char a[200];
for(int i=0; i<n; i++){
a[i]='0';
}
map<int, int>ans;
uniform_int_distribution<>gen(0, n-1);
compile_set();
for(int t=n-1; t>0; t--){
int qwe=gen(engine);
while(true){
while(a[qwe]=='1'){
qwe=gen(engine);
}
string q="";
for(int i=0; i<n; i++){
if(a[i]=='1'){
q+=a[i];
continue;
}
if(i==qwe){
q+='1';
}
else{
q+='0';
}
}
if(check_element(q)){
a[qwe]='1';
ans[qwe]=t;
break;
}
qwe++;
}
}
vector<int>res;
for(int i=0; i<n; i++){
res.push_back(ans[i]);
}
return res;
}
# | 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... |