# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
72702 | ikura355 | Broken Device (JOI17_broken_device) | C++14 | 77 ms | 3984 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;
const int maxn = 150 + 5;
int bad[maxn], res[maxn];
void Anna(int N, long long X, int K, int P[]) {
for(int i=0;i<N;i++) bad[i] = 0;
for(int i=0;i<K;i++) bad[P[i]] = 1;
for(int i=0;i<N;i++) res[i] = 0;
for(int i=0;i<N;i+=3) {
if(bad[i] + bad[i+1] + bad[i+2] == 0) {
int val = X%4;
if(val==0) res[i] = res[i+2] = 1;
if(val==1) res[i+1] = 1;
if(val==2) res[i] = res[i+1] = res[i+2] = 1;
if(val==3) res[i+1] = 1, res[i+2] = 1;
X /= 4;
}
else if(bad[i] + bad[i+1] + bad[i+2] == 1) {
int val = X%2;
if(val==0) {
if(bad[i] || bad[i+1]) res[i+2] = 1;
if(bad[i+2]) res[i] = res[i+1] = 1;
}
if(val==1) {
if(bad[i+1] || bad[i+2]) {
res[i] = 1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |