Submission #254931

#TimeUsernameProblemLanguageResultExecution timeMemory
254931ChrisTUnscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
2 ms512 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; int n; vector<int> ret; void build (int l, int r) { if (l == r) return; string go = string(n,'0'); for (int i = l; i <= r; i++) go[i] = '1'; int mid = (l + r) / 2; for (int i = l; i <= mid; i++) { go[i] = '0'; add_element(go); go[i] = '1'; } build(l,mid); build(mid+1,r); } void solve (int l, int r, vector<int> &wot) { if (l == r) return (void) (ret[l] = wot[0]); vector<int> wotL, wotR; string go = string(n,'0'); for (int i : wot) go[i] = '1'; for (int i : wot) { go[i] = '0'; if (check_element(go)) wotL.push_back(i); else wotR.push_back(i); go[i] = '1'; } int mid = (l + r) / 2; solve(l,mid,wotL); solve(mid+1,r,wotR); } vector<int> restore_permutation (int N, int w, int r) { n=N; vector<int> go(n); iota(go.begin(),go.end(),0); ret.resize(n); build(0,n-1); compile_set(); solve(0,n-1,go); 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...