제출 #163862

#제출 시각아이디문제언어결과실행 시간메모리
163862WLZUnscrambling a Messy Bug (IOI16_messy)C++14
20 / 100
4 ms632 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; vector<int> ans; int n; void solve(int l, int r, set<int> st) { if (l == r) { ans[l] = *st.begin(); return; } string s(n, '0'); for (int i = 0; i < n; i++) { if (!st.count(i)) { s[i] = '1'; } } set<int> tmp_l, tmp_r; for (auto& x : st) { s[x] = '1'; if (check_element(s)) { tmp_l.insert(x); } else { tmp_r.insert(x); } s[x] = '0'; } solve(l, (l + r) / 2, tmp_l); solve((l + r) / 2 + 1, r, tmp_r); } vector<int> restore_permutation(int _n, int w, int r) { n = _n; for (int k = 2; k <= n; k += k) { for (int i = 0; i + k - 1 < n; i += k) { string s(n, '1'); for (int j = i; j < i + k; j++) { s[j] = '0'; } for (int j = i; j < i + k / 2; j++) { s[j] = '1'; add_element(s); s[j] = '0'; } } } compile_set(); ans.assign(n, -1); set<int> st; for (int i = 0; i < n; i++) { st.insert(i); } solve(0, n - 1, st); 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...