# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1256328 | gelastropod | Unscrambling a Messy Bug (IOI16_messy) | C++20 | 1 ms | 580 KiB |
#include <bits/stdc++.h>
#include "messy.h"
using namespace std;
#define LOGN 8
std::vector<int> restore_permutation(int n, int w, int r) {
for (int i = LOGN - 1; i >= 0; i--) {
int mask = (((1LL << (LOGN - 1 - i)) - 1) << (i + 1));
for (int j = 0; j < n; j++) {
if (j & (1LL << i)) continue;
string qry(n, '1');
for (int k = 0; k < n; k++) if (j != k && (j & mask) == (k & mask)) qry[k] = '0';
add_element(qry);
}
}
compile_set();
vector<int> ord(n, 0);
for (int i = LOGN - 1; i >= 0; i--) {
int mask = (((1LL << (LOGN - 1 - i)) - 1) << (i + 1));
for (int j = 0; j < n; j++) {
string qry(n, '1');
for (int k = 0; k < n; k++) if (j != k && (ord[j] & mask) == (ord[k] & mask)) qry[k] = '0';
if (!check_element(qry)) ord[j] += (1LL << i);
}
}
return ord;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |