제출 #231110

#제출 시각아이디문제언어결과실행 시간메모리
231110a_playerUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
6 ms512 KiB
#include "messy.h" #include <bits/stdc++.h> #ifdef ALE #include "grader.cpp" #endif using namespace std; /* add_element("0"); compile_set(); check_element("0"); */ int N; vector<int> ans; void add(int l, int r){ if(l==r)return; int m=(l+r)/2; string s(N,'1'); for(int i=l;i<=r;i++)s[i]='0'; for(int i=l;i<=m;i++){ s[i]='1'; add_element(s); s[i]='0'; } add(l,m); add(m+1,r); } void search(int l, int r, vector<int> a){ if(l==r){ ans[a[0]]=l; return; } int m=(l+r)/2; string s(N,'1'); for(int x:a)s[x]='0'; vector<int> dx,sx; for(int x:a){ s[x]='1'; if(check_element(s)) sx.push_back(x); else dx.push_back(x); s[x]='0'; } search(l,m,sx); search(m+1,r,dx); } vector<int> restore_permutation(int n, int w, int r) { N=n; ans.resize(n); add(0,N-1); compile_set(); vector<int> a(N); iota(a.begin(),a.end(),0); search(0,N-1,a); 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...