Submission #102638

#TimeUsernameProblemLanguageResultExecution timeMemory
102638alexpetrescuBroken Device (JOI17_broken_device)C++14
41 / 100
134 ms3072 KiB
#include "Annalib.h" void Anna( int N, long long X, int K, int P[] ){ int poz = 0, b = 59; bool bit = 1; for (int i = 0; i < N; i++) { if (poz < K && P[poz] == i) { bit ^= 1; Set(i, 0); poz++; } else if (b >= 0 && bit == bool((1LL << b) & X)) { Set(i, 1); b--; } else { bit ^= 1; Set(i, 0); } } }
#include "Brunolib.h" long long Bruno( int N, int A[] ){ bool bit = 1; long long ans = 0; for (int i = 0; i < N; i++) { if (A[i] == 0) bit ^= 1; else ans = 2 * ans + bit; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...