이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |