제출 #388854

#제출 시각아이디문제언어결과실행 시간메모리
388854alireza_kavianiUnscrambling a Messy Bug (IOI16_messy)C++11
100 / 100
4 ms460 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; vector<int> restore_permutation(int n, int w, int r) { // check_element("0"); vector<int> ans(n , 0); int b = 0; for(int i = 0 ; i < 10 ; i++){ if(n == (1 << i)) b = i; } for(int i = 0 ; i < b ; i++){ int cur = (1 << i) - 1; for(int j = 0 ; j < n ; j++){ if((j & (1 << i)) == 0) continue; string s; for(int k = 0 ; k < n ; k++){ if((k & cur) != (j & cur) || j == k) s.push_back('1'); else s.push_back('0'); } add_element(s); } } compile_set(); for(int i = 0 ; i < b ; i++){ vector<int> vec; for(int j = 0 ; j < n ; j++){ string s; for(int k = 0 ; k < n ; k++){ if(ans[j] != ans[k] || j == k) s.push_back('1'); else s.push_back('0'); } vec.push_back(check_element(s)); } for(int j = 0 ; j < n ; j++){ if(vec[j]) ans[j] |= (1 << i); } } 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...