Submission #591956

#TimeUsernameProblemLanguageResultExecution timeMemory
591956wdjpngUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
3 ms596 KiB
#include <bits/stdc++.h> #define int long long #define rep(i,n) for(int i = 0; i < n; i++) #define all(a) a.begin(), a.end() #include "messy.h" using namespace std; vector<signed>p; int n; vector<string>added; void adds(int l, int r) { if(l+1==r) return; int m = (l+r)/2; string s(n,'0'); rep(i,n) if(i<l||i>=r) s[i]='1'; for(int i = l; i < m; i++) { s[i]='1'; add_element(s); added.push_back(s); s[i]='0'; } adds(l,m); adds(m,r); } void queries(int l, int r, vector<int>ing) { if(l+1==r) {p[ing[0]]=l; return;} vector<bool>innew(n,false); string s(n,'0'); rep(i,n) if(find(all(ing), i)==ing.end()) s[i]='1'; vector<vector<int>>ning(2); for(int x : ing) { s[x]='1'; ning[!check_element(s)].push_back(x); s[x]='0'; } queries(l,(l+r)/2,ning[0]); queries((l+r)/2,r,ning[1]); } vector<signed> restore_permutation(signed N, signed w, signed r) { n=N; p.assign(n,-1); adds(0,n); compile_set(); vector<int>ing(n); rep(i,n) ing[i]=i; queries(0,n,ing); 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...