# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
21590 | Ushio | Broken Device (JOI17_broken_device) | C++14 | 52 ms | 4636 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 <algorithm>
#include <iostream>
#include <cstdlib>
#include <vector>
using namespace std;
void Anna(int N, long long X, int K, int P[] ){
vector<int> bits(N);
for (int i = 0; i < N; ++i) {
bits[i] = i >= 60 ? 0: ((X & (1LL << i)) != 0);
}
vector<int> bad(N, 0);
for (int i = 0; i < K; ++i) {
bad[P[i]] = 1;
}
int pos = 0;
for (int i = 0; i < N; i += 3) {
int cnt = bad[i] + bad[i + 1] + bad[i + 2];
if (cnt == 0) {
if (bits[pos] == 0 && bits[pos + 1] == 0) {
Set(i , 1);
Set(i + 1, 0);
Set(i + 2, 0);
} else if (bits[pos] == 0 && bits[pos + 1] == 1) {
Set(i , 1);
Set(i + 1, 0);
Set(i + 2, 1);
} else if (bits[pos + 1] == 0) {
Set(i , 0);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |