Submission #171608

#TimeUsernameProblemLanguageResultExecution timeMemory
171608maximath_1Unscrambling a Messy Bug (IOI16_messy)C++11
0 / 100
2 ms376 KiB
#include "messy.h" #include<bits/stdc++.h> using namespace std; #define init int cl=0, int cr=n-1 #define md (cl+cr)/2 #define lc cl, md #define rc md+1, cr int n, p[128]; void add(init){ if(cl==cr) return; string str(n, '0'); for(int i=cl; i<=cr; i++) str[i]='1'; for(int i=md+1; i<=cr; i++){ str[i]='0'; str[i]='1'; } add(lc); add(rc); } void check(vector<int>s, init){ if(cl==cr){ p[s[0]]=cl; return; } string str(n, '0'); for(auto &i:s) str[i]='1'; vector<int>l, r; for(auto &i:s){ str[i]='0'; if(check_element(str)) r.push_back(i); else l.push_back(i); str[i]='1'; } check(l, lc); check(r, rc); } vector<int> restore_permutation(int _n, int w, int r){ n=_n; add(); vector<int>v; for(int i=0; i<n; i++) v.push_back(i); check(v); vector<int>ans; for(int i=0; i<n; i++) ans.push_back(p[i]); return ans; }
#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...