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 <string>
#include "messy.h"
using namespace std;
string str;
int N;
vector<int> ans, arr, arr2;
void init(){
for(int i=0; i<N; i++) str.push_back('0');
for(int i=0; i<N; i++) ans.push_back(0);
for(int i=0; i<N; i++) arr.push_back(0);
for(int i=0; i<N; i++) arr2.push_back(0);
}
void a(){
add_element(str);
}
void c(char ch){
for(int i=0; i<N; i++) str[i]=ch;
}
vector<int> restore_permutation(int n, int w, int r) {
N=n;
init();
n/=2;
while(n>0){
for(int i=0; i<N; i+=2*n){
for(int j=i+n; j<i+2*n; j++){
c('1');
for(int k=i; k<i+2*n; k++){
str[k]='0';
}
str[j]='1';
a();
}
}
n/=2;
}
compile_set();
n=N/2;
while(n>0){
for(int j=0; j<N; j++){
c('1');
for(int k=0; k<N; k++){
if(arr[k]==arr[j]) str[k]='0';
}
str[j]='1';
if(check_element(str)){
arr2[j]+=n;
}
}
for(int i=0; i<N; i++){
arr[i]+=arr2[i];
arr2[i]=0;
}
n/=2;
}
return arr;
}
# | 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... |