Submission #885259

#TimeUsernameProblemLanguageResultExecution timeMemory
885259hugsfromadictoUnscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
1 ms1116 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; int N; const int MAX=130; void write(int l, int r, int N) { if(l==r) return; string s=""; for(int i=0;i<N;++i) { if(l<=r and i<=r) { s+='0'; } else { s+='1'; } } int mid=(l+r)>>1; for(int i=l;i<=mid;++i) { s[i]='1'; add_element(s); s[i]='0'; } write(l,mid,N); write(mid+1,r,N); } int p[MAX]; void read(int l, int r, vector<int> v, int N) { if(l==r) { p[v[0]]=l; return; } string s=""; for(int i=0;i<N;++i) { s+='1'; } for(int a:v) { s[a]='0'; } int mid=(l+r)>>1; vector<int>left,right; for(int i:v) { s[i]='1'; if(check_element(s)) { left.push_back(i); } else{ right.push_back(i); } s[i]='0'; } read(l, mid, left, N); read(mid + 1, r, right, N); } vector<int> restore_permutation(int N,int w,int r) { write(0,N-1,N); compile_set(); vector<int>tmp; for(int i=0;i<N;++i) { tmp.push_back(i); } read(0,N-1,tmp,N); vector<int>res; for(int i = 0; i < N; i++){ res.push_back(p[i]); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...