Submission #390283

#TimeUsernameProblemLanguageResultExecution timeMemory
390283faresbasbsUnscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
2 ms460 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; int n,freq[128]; vector<int> v; void hs(int l , int r){ if(l == r){ return ; } string s(n,'0'); for(int i = l ; i <= r ; i += 1){ s[i] = '1'; } int mid = (l+r)/2; for(int i = mid+1 ; i <= r ; i += 1){ s[i] = '0'; add_element(s); s[i] = '1'; } hs(l,mid),hs(mid+1,r); } void hs2(int l , int r){ if(l == r){ freq[v[0]] = l; return ; } string s(n,'0'); for(int i : v){ s[i] = '1'; } int mid = (l+r)/2; vector<int> ll , rr; for(int i : v){ s[i] = '0'; if(check_element(s)){ ll.push_back(i); }else{ rr.push_back(i); } s[i] = '1'; } v = ll , hs2(l,mid) , v = rr , hs2(mid+1,r); } vector<int> restore_permutation(int N , int w , int r){ n = N; hs(0,n-1); compile_set(); for(int i = 0 ; i < n ; i += 1){ v.push_back(i); } hs2(0,n-1); vector<int> ret; for(int i = 0 ; i < n ; i += 1){ ret.push_back(freq[i]); } return ret; }
#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...