# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
715720 | valerikk | Broken Device (JOI17_broken_device) | C++17 | 62 ms | 2720 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"
#include <bits/stdc++.h>
using namespace std;
void Anna( int N, long long X, int K, int P[] ){
mt19937 rnd(239);
vector<int> ord(N);
iota(ord.begin(), ord.end(), 0);
shuffle(ord.begin(), ord.end(), rnd);
vector<int> bad(N, 0);
for (int i = 0; i < K; ++i) {
bad[P[i]] = 1;
}
vector<int> a(N, 0);
for (int i = 0; i + 1 < N; i += 2) {
if (!bad[ord[i]] && !bad[ord[i + 1]]) {
if (X % 3 == 0) {
a[ord[i]] = 1;
}
if (X % 3 == 1) {
a[ord[i + 1]] = 1;
}
if (X % 3 == 2) {
a[ord[i]] = a[ord[i + 1]] = 1;
}
X /= 3;
}
}
for (int i = 0; i < N; ++i) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |