제출 #855601

#제출 시각아이디문제언어결과실행 시간메모리
855601JooDdaeUnscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
1 ms604 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; using ll = long long; #define mid ((l+r) >> 1) void add(int l, int r, int n) { if(l == r) return; string s(n, '1'); for(int i=l;i<=r;i++) s[i] = '0'; for(int i=l;i<=mid;i++) { s[i] = '1'; add_element(s); s[i] = '0'; } add(l, mid, n); add(mid+1, r, n); } vector<int> ans; void solve(int l, int r, int n, vector<int> v) { if(l == r) { ans.push_back(v[0]); return; } string s(n, '1'); for(auto x : v) s[x] = '0'; vector<int> v1, v2; for(int x : v) { s[x] = '1'; if(check_element(s)) v1.push_back(x); else v2.push_back(x); s[x] = '0'; } solve(l, mid, n, v1); solve(mid+1, r, n, v2); } vector<int> restore_permutation(int n, int w, int r) { add(0, n-1, n); compile_set(); vector<int> v(n); iota(v.begin(), v.end(), 0); solve(0, n-1, n, v); 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...