# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
334904 | dolphingarlic | Broken Device (JOI17_broken_device) | C++14 | 48 ms | 2752 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 "Annalib.h"
void set(int p, int x) { for (int i = 0; i < 3; i++) Set(p + i, (x >> i) & 1); }
void Anna(int N, long long X, int K, int P[]) {
bool B[150];
for (int i = 0; i < N; i++) B[i] = false;
for (int i = 0; i < K; i++) B[P[i]] = true;
for (int i = 0, j = 0; i < N; i += 3) {
if (j > 62 || B[i] + B[i + 1] + B[i + 2] > 1) set(i, 0);
else if ((!B[i] && !B[i + 1] && !B[i + 2]) || (B[i + 1] && !(X & (1ll << j)))) {
if (X & (1ll << j)) {
if (X & (1ll << j + 1)) set(i, 7);
else set(i, 3);
} else {
if (X & (1ll << j + 1)) set(i, 5);
else set(i, 4);
}
j += 2;
} else {
if (!(X & (1ll << j))) set(i, 2);
else if (B[i]) set(i, 6);
else set(i, 1);
j++;
}
}
}
#include "Brunolib.h"
long long Bruno(int N, int A[]) {
long long ans = 0;
for (int i = 0, j = 0; i < N; i += 3) {
int hsh = A[i] + 2 * A[i + 1] + 4 * A[i + 2];
switch (hsh) {
case 1: case 6: ans += 1ll << j;
case 2: j++; break;
case 7: ans += 1ll << j;
case 5: ans += 1ll << j + 1; j += 2; break;
case 3: ans += 1ll << j;
case 4: j += 2; break;
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |