제출 #672509

#제출 시각아이디문제언어결과실행 시간메모리
672509Trisanu_DasUnscrambling a Messy Bug (IOI16_messy)C++17
100 / 100
2 ms468 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int>P; int N; void add(int l,int r){ if(r - l==1)return; int m = (l + r) / 2; string s(N,'0'); for(int i = l; i < r; i++) s[i] = '1'; for(int i = l;i < m ;i++){ s[i] = '0'; add_element(s); s[i] = '1'; } add(l, m); add(m, r); } vector<int>u; void solve(vector<int> v){ if(v.size() == 1) return; string s(N,'0'); for(int i : v) s[i] = '1'; int add = v.size()/2; vector<int> a, b; for(int i : v){ s[i] = '0'; if(check_element(s)) a.push_back(i); else b.push_back(i), u[i] += add; s[i] = '1'; } solve(a); solve(b); } vector<int> restore_permutation(int n, int w, int r) { N = n; add(0,N); compile_set(); vector<int>v(n); for(int i = 0; i < n; i++) v[i] = i; u = vector<int>(n); solve(v); return u; }
#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...