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>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define all(x) x.begin(),x.end()
using ll=long long;
#include "messy.h"
int mask(int x){
return (1<<x)-1;
}
std::vector<int> restore_permutation(int n, int w, int r) {
vector<int> p(n,0);
int b=0;
while((1<<b)!=n)b++;
rep(i,b){
rep(j,n){
if(!((j>>i)&1))continue;
string s="";
rep(k,n){
if((j&mask(i))!=(k&mask(i))){
s=s+"1";
}
else if(j==k){
s=s+"1";
}
else{
s=s+"0";
}
}
add_element(s);
}
}
compile_set();
rep(i,b){
rep(j,n){
string s="";
rep(k,n){
if((p[j]&mask(i))!=(p[k]&mask(i))){
s=s+"1";
}
else if(j==k){
s=s+"1";
}
else{
s=s+"0";
}
}
if(check_element(s)){
p[j]+=1<<i;
}
}
}
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... |