# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1101127 | rainboy | Machine (IOI24_machine) | C++17 | 9 ms | 592 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "machine.h"
#include <vector>
using namespace std;
typedef vector<int> vi;
const int L = 8;
vi find_permutation(int n) {
vi aa(n);
for (int i = 0; i < n; i++)
aa[i] = i;
if (n % 2 == 0) {
int l = 0;
while (1 << l + 1 <= n)
l++;
aa[(1 << l) - 1] = (n + 2 & n + 1) == 0 ? n + 2 : n;
}
vi pp = use_machine(aa);
int x = 0;
for (int l = 0; l < L; l++) {
int d = 0;
for (int i = 0; i < n; i++)
d += (pp[i] & 1 << l) != 0 ? 1 : -1;
if (d > 0)
x ^= 1 << l;
}
for (int i = 0; i < n; i++)
pp[i] ^= x;
if (n % 2 == 0) {
int l = 0;
while (1 << l + 1 <= n)
l++;
for (int i = 0; i < n; i++)
if (pp[i] >= n) {
pp[i] = (1 << l) - 1;
break;
}
}
return pp;
}
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |