제출 #436882

#제출 시각아이디문제언어결과실행 시간메모리
436882dutchUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
3 ms588 KiB
#include <bits/stdc++.h> using namespace std; #include "messy.h" vector<int> res(128); int N; void init(int l, int r){ if(r-l < 2) 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'; } init(l, m), init(m, r); } void find(int l, int r, vector<int> &v){ if(r-l < 2) return void(res[v[0]] = l); int m = (l + r) / 2; vector<int> a[2]; string s(N, '1'); for(int i : v) s[i] = '0'; for(int i : v){ s[i] = '1'; a[!check_element(s)].push_back(i); s[i] = '0'; } find(l, m, a[0]), find(m, r, a[1]); } vector<int> restore_permutation(int n, int __0, int __1){ N = n; vector<int> a(n); iota(a.begin(), a.end(), 0); init(0, n); compile_set(); find(0, n, a); res.resize(n); return res; }
#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...