Submission #1219985

#TimeUsernameProblemLanguageResultExecution timeMemory
1219985vako_pBroken Device (JOI17_broken_device)C++20
85 / 100
20 ms1544 KiB
#include "Annalib.h" #define ll long long void Anna( int N, long long X, int K, int P[] ){ ll x = X,y = 1; ll a[200]; bool vis[N]; for(int i = 0; i < N; i++) vis[i] = a[i] = false; for(int i = 0; i < K; i++) vis[P[i]] = true; for(int i = 0; i < 37; i++) y *= 3LL; ll bit = 37; while(x > 0){ a[bit--] = x / y; x %= y; y /= 3LL; } bit = 0; for(int i = 0; i < N; i += 2){ if(bit < 38 and !vis[i] and !vis[i + 1]){ Set(i, (a[bit] + 1) / 2); Set(i + 1, 1 - a[bit] / 2); bit++; } else{ Set(i, 0); Set(i + 1, 0); } } return; }
#include "Brunolib.h" #define ll long long long long Bruno( int N, int A[] ){ ll x = 0,y = 1; for(int i = 0; i < N; i += 2){ if(A[i] or A[i + 1]){ if(A[i] and !A[i + 1]) x += 2LL * y; if(A[i] and A[i + 1]) x += y; y *= 3; } } return x; }
#Verdict Execution timeMemoryGrader output
Fetching results...