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 "messy.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> restore_permutation(int n, int w, int r) {
for(int bit = n >> 1;bit > 0;bit >>= 1){
for(int i = 0;i < n;i++){
if(i & bit){
string s = "";
for(int j = 0;j < n;j++){
if(i == j) s += "1";
else{
if(j / (bit*2) == i / (bit*2))
s += "0";
else
s += "1";
}
}
add_element(s);
}
}
}
vector<int> answer;
compile_set();
typedef pair<int,int> ii;
vector<ii> current;
vector<ii> nxt;
for(int i = 0;i < n;i++){
current.push_back(ii(i,0));
}
for(int t = 0;t < log2(n);t++){
sort(current.begin(),current.end());
for(int i = 0;i < n;i++){
string s = "";
for(int j = 0;j < n;j++){
if(i == j) s += "1";
else if(current[i].second == current[j].second) s += "0";
else s += "1";
}
if(check_element(s)){
nxt.push_back(ii(current[i].first,current[i].second*2+1));
}
else{
nxt.push_back(ii(current[i].first,current[i].second*2));
}
}
current.clear();
for(ii x : nxt) current.push_back(x);
nxt.clear();
}
for(ii x : current){
answer.push_back(x.second);
}
return answer;
}
# | 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... |