# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
923141 | gawr_gura | Broken Device (JOI17_broken_device) | C++17 | 28 ms | 2952 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 <bits/stdc++.h>
#include "Annalib.h"
using namespace std;
mt19937 rng(0303);
void Anna(int N, long long X, int K, int P[]) {
X += rng();
assert(X < 1ll << 60);
vector<int> wrong(N + 10);
for (int i = 0; i < K; i++) {
wrong[P[i]] = 1;
}
vector<int> ans(N + 10);
for (int i = 0; i < N; i++) {
if (wrong[i]) continue;
if (X & 1) {
if (wrong[i + 2]) {
wrong[i + 1] = 1;
continue;
}
ans[i] = 1, ans[i + 1] = 0, ans[i + 2] = 1;
i++;
} else {
if (wrong[i + 1]) {
wrong[i + 2] = 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]);
}
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
mt19937 rng(0303);
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 - rng();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |