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 "messy.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> restore_permutation(int n, int w, int r) {
int lg=31-__builtin_clz(n);
vector<int> ans(n);
string s(n, '0');
for (int i=0; i<lg; ++i){
vector<int> v;
for (int j=0; j<n; ++j) if (j>>i&1) v.push_back(j);
for (int j:v){
s[j]^=1;
add_element(s);
s[j]^=1;
}
for (int j:v) s[j]^=1;
}
compile_set();
string t(n, '0');
for (int i=0; i<lg; ++i){
vector<int> v;
for (int j=0; j<n; ++j){
t[j]^=1;
if (check_element(t)) v.push_back(j);
t[j]^=1;
}
for (int j:v) ans[j]^=1<<i, t[j]^=1;
}
return ans;
}
# | 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... |