# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
923133 | gawr_gura | Broken Device (JOI17_broken_device) | C++17 | 31 ms | 2936 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.
// Alice
#include <bits/stdc++.h>
#include "Annalib.h"
using namespace std;
void Anna(int N, long long X, int K, int P[]) {
vector<int> wrong(N);
for (int i = 0; i < K; i++) {
wrong[P[i]] = 1;
if (P[i] == 0) {
wrong[P[i] + 1] = 1;
} else if (wrong[P[i] - 1]) {
continue;
} else {
wrong[P[i] - 1] = 1;
}
}
int last = -1;
for (int i = 0; i < N; i++) {
if (wrong[i]) {
if (i - last < 4) {
for (int j = last + 1; j < i; j++) wrong[j] = 1;
}
}
}
vector<int> ans(N);
for (int i = 0; i < N; i++) {
if (wrong[i]) continue;
if (X & 1) {
if (wrong[i + 1] || wrong[i + 2]) continue;
ans[i] = 1, ans[i + 1] = 0, ans[i + 2] = 1;
i++;
} else {
if (wrong[i + 1]) continue;
ans[i] = 1, ans[i + 1] = 1;
}
X /= 2;
if (X == 0) break;
}
for (int i = 0; i < N; i++) Set(i, ans[i]);
}
// Bruno
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
long long Bruno(int N, int A[]) {
int64_t X = 0;
vector<int> ans(N + 2);
for (int i = 0; i < N; i++) ans[i] = A[i];
int cnt = 0;
for (int i = 0; i < N; i++) {
if (ans[i] == 1) {
if (ans[i + 1] == 1) {
cnt++;
} else if (ans[i + 2] == 1) {
X += 1ll << cnt++;
i++;
} else {
continue;
}
}
}
return X;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |