Submission #26402

#TimeUsernameProblemLanguageResultExecution timeMemory
26402pacuBroken Device (JOI17_broken_device)C++98
85 / 100
62 ms4636 KiB
#include "Annalib.h" #include <iostream> using namespace std; bool broken[150]; void Anna(int N,long long X,int K,int P[]) { for(int i=0;i<N;i++) broken[i] = 0; for(int i=0;i<K;i++) broken[P[i]] = 1; for(int i=0;i<N;i+=2) { if(broken[i] || broken[i+1]) { Set(i,0); Set(i+1,0); } else { if(X%3 == 0) Set(i,0), Set(i+1,1); else if(X%3 == 1) Set(i,1), Set(i+1,0); else if(X%3 == 2) Set(i,1), Set(i+1,1); X /= 3; } } }
#include "Brunolib.h" #include <iostream> using namespace std; long long Bruno(int N,int A[]) { long long X = 0; for(int i=N-2;i>=0;i-=2) { if(A[i]==0 && A[i+1]==0) continue; X *= 3; if(A[i]==0 && A[i+1]==1) X += 0; if(A[i]==1 && A[i+1]==0) X += 1; if(A[i]==1 && A[i+1]==1) X += 2; } return X; }
#Verdict Execution timeMemoryGrader output
Fetching results...