# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1167379 | trandangquang | Broken Device (JOI17_broken_device) | C++20 | 0 ms | 0 KiB |
#include"Annalib.h"
#include<bits/stdc++.h>
using namespace std;
void Anna(int N, long long X, int K, int P[]){
vector<int> A(N,0);
for(int i=0; i<K; ++i) A[P[i]]=1;
deque<int> dq;
for(int i=0; i<60; ++i){
dq.push_back(X>>i&1);
}
for(int i=0; i<120; ++i) dq.push_back(0);
for(int i=0; i<N; i+=3){
int t=A[i]+A[i+1]+A[i+2];
if(t>=2){
hihi(i,0);
}
else if(t==1){
if(A[i]==1){
if(dq[0]) hihi(i,6);
else hihi(i,2);
dq.pop_front();
}
else if(A[i+1]==1){
if(dq[0]){
hihi(i,1);
dq.pop_front();
}