Submission #935151

#TimeUsernameProblemLanguageResultExecution timeMemory
935151MackerUnscrambling a Messy Bug (IOI16_messy)C++17
70 / 100
1 ms856 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(v) v.begin(), v.end() #define FOR(i, n) for (int i = 0; i < n; i++) std::vector<int> restore_permutation(int n, int w, int r) { int log = (int)(log2(n) + 0.5); FOR(l, log){ string s(n, '0'); FOR(j, l) s[j] = '1'; FOR(i, n){ if(i & (1 << l)){ string t = s; t[i] = '1'; add_element(t); } } string t(n, '0'); FOR(j, n) if(s[j] == '0') t[j] = '1'; add_element(t); } compile_set(); vector<int> ids; vector<int> p(n, 0); FOR(l, log){ string s(n, '0'); for (int j : ids) s[j] = '1'; FOR(i, n){ if(s[i] == '1') continue; string t = s; t[i] = '1'; if(check_element(t)){ p[i] |= (1 << l); } } s = string(n, '1'); for (int j : ids) s[j] = '0'; FOR(i, n){ if(s[i] == '0') continue; string t = s; t[i] = '0'; if(check_element(t)){ ids.push_back(i); break; } } } return p; }
#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...