Submission #123033

#TimeUsernameProblemLanguageResultExecution timeMemory
123033tjd229Broken Device (JOI17_broken_device)C++14
41 / 100
50 ms3312 KiB
#include "Annalib.h" void Anna( int N, long long X, int K, int P[] ){ int mem[150] = { 0 }; for (int i = 0; i < K; ++i) mem[P[i]] = 1; int pos = 0; while (X && pos+1<N) { if (mem[pos] + mem[pos + 1]) ++pos; else { mem[pos++] = 2; mem[pos++] = (X & 1) + 1; X >>= 1; } } for (int i = 0; i < N; ++i) Set(i,mem[i]? mem[i]-1:0); }
#include "Brunolib.h" long long Bruno( int N, int A[] ){ long long X = 0; int recon[60] = { 0 }; int pos = 0; for (int i = 0; i < N;++i) { if (A[i]) { recon[pos++]=A[++i]; } } while (pos--) { X <<= 1; X += recon[pos]; } return X; }
#Verdict Execution timeMemoryGrader output
Fetching results...