제출 #160505

#제출 시각아이디문제언어결과실행 시간메모리
160505oolimryUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
9 ms632 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; std::vector<int> restore_permutation(int n, int w, int r) { for(int bit = n >> 1;bit > 0;bit >>= 1){ for(int i = 0;i < n;i++){ if(i & bit){ string s = ""; for(int j = 0;j < n;j++){ if(i == j) s += "1"; else{ if(j / (bit*2) == i / (bit*2)) s += "0"; else s += "1"; } } add_element(s); } } } vector<int> answer; compile_set(); typedef pair<int,int> ii; vector<ii> current; vector<ii> nxt; for(int i = 0;i < n;i++){ current.push_back(ii(i,0)); } for(int t = 0;t < log2(n);t++){ sort(current.begin(),current.end()); for(int i = 0;i < n;i++){ string s = ""; for(int j = 0;j < n;j++){ if(i == j) s += "1"; else if(current[i].second == current[j].second) s += "0"; else s += "1"; } if(check_element(s)){ nxt.push_back(ii(current[i].first,current[i].second*2+1)); } else{ nxt.push_back(ii(current[i].first,current[i].second*2)); } } current.clear(); for(ii x : nxt) current.push_back(x); nxt.clear(); } for(ii x : current){ answer.push_back(x.second); } return answer; }
#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...