Submission #231363

#TimeUsernameProblemLanguageResultExecution timeMemory
231363islingrUnscrambling a Messy Bug (IOI16_messy)C++14
100 / 100
7 ms640 KiB
#include "messy.h" #include <algorithm> #include <vector> using namespace std; #define rep(i, a, b) for (auto i = (a); i < (b); ++i) vector<int> restore_permutation(int n, int, int) { for (int z = n; z != 1; z >>= 1) for (int l = 0; l != n; l += z) { string s(n, '1'); rep(i, l, l + z) s[i] = '0'; rep(i, l, l + z / 2) { s[i] = '1'; add_element(s); s[i] = '0'; } } compile_set(); vector<int> p(n); rep(i, 0, n) p[i] = i; for (int z = n; z != 1; z >>= 1) { vector<bool> v(n); for (int l = 0; l != n; l += z) { string s(n, '1'); rep(i, l, l + z) s[p[i]] = '0'; rep(i, l, l + z) { s[p[i]] = '1'; v[p[i]] = check_element(s); s[p[i]] = '0'; } partition(begin(p) + l, begin(p) + l + z, [&v](int x) { return v[x]; }); } } vector<int> q(n); rep(i, 0, n) q[p[i]] = i; return q; }
#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...