제출 #206778

#제출 시각아이디문제언어결과실행 시간메모리
206778TAISA_Unscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
8 ms888 KiB
#include <bits/stdc++.h> #define eb emplace_back #include "messy.h" using namespace std; void write(int n,int l,int r){ string s(n,'0'); if(l==0&&r==n){ for(int i=0;i<n/2;i++){ s[i]='1'; add_element(s); s[i]='0'; } write(n,0,n/2); write(n,n/2,n); return; } if(r-l==1)return; int m=(l+r)/2; for(int i=m;i<r;i++)s[i]='1'; for(int i=l;i<m;i++){ s[i]='1'; add_element(s); s[i]='0'; } write(n,l,m); write(n,m,r); } std::vector<int> restore_permutation(int n, int w, int r) { write(n,0,n); compile_set(); vector<vector<int>> vs(2*n); string s(n,'0'); for(int i=0;i<n;i++){ s[i]='1'; if(check_element(s)){ vs[2].eb(i); }else{ vs[3].eb(i); } s[i]='0'; } for(int i=2;i<n;i++){ int p=((i>>1)<<1)|1; s=string(n,'0'); for(auto &e:vs[p]){ s[e]='1'; } for(auto &e:vs[i]){ s[e]='1'; if(check_element(s)){ vs[i<<1].eb(e); }else{ vs[i<<1|1].eb(e); } s[e]='0'; } } vector<int> p(n); for(int i=0;i<n;i++){ p[vs[i+n][0]]=i; } return p; }
#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...