# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
334040 | dolphingarlic | Broken Device (JOI17_broken_device) | C++14 | 75 ms | 2912 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 Anna(int N, long long X, int K, int P[]) {
bool broken[150];
for (int i = 0; i < N; i++) broken[i] = false;
for (int i = 0; i < K; i++) broken[P[i]] = true;
for (int i = 0, j = 0; i < N; i += 3) {
if (broken[i] + broken[i + 1] + broken[i + 2] > 1 || j > 62) {
Set(i, 0);
Set(i + 1, 0);
Set(i + 2, 0);
} else {
if (X & (1ll << j)) {
for (int k = i, cnt = 0; k < i + 3; k++) {
if (!broken[k] && cnt++ < 2) Set(k, 1);
else Set(k, 0);
}
} else {
for (int k = i, cnt = 0; k < i + 3; k++) {
if (!broken[k] && cnt++ < 1) Set(k, 1);
else Set(k, 0);
}
}
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 cnt = A[i] + A[i + 1] + A[i + 2];
if (!cnt) continue;
ans += (cnt == 2) * (1ll << j);
j++;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |