Submission #1154546

#TimeUsernameProblemLanguageResultExecution timeMemory
1154546yhkhooBroken Device (JOI17_broken_device)C++20
85 / 100
22 ms1544 KiB
#include "Annalib.h" typedef long long ll; void Anna( int N, ll X, int K, int P[] ){ int xd[38]; bool p[N]; for(int i=0; i<N; i++){ p[i] = 0; } for(int i=0; i<K; i++){ p[P[i]] = 1; } ll x = X; for(int i=0; i<38; i++){ xd[i] = x % 3; x /= 3; } auto xp = xd; for(int i=0; i<N; i+=2){ if(xp-xd == 38 || p[i] || p[i+1]){ Set(i, 0); Set(i+1, 0); continue; } if((*xp) == 0){ Set(i, 0); Set(i+1, 1); } else if((*xp) == 1){ Set(i, 1); Set(i+1, 0); } else{ Set(i, 1); Set(i+1, 1); } xp++; } }
#include "Brunolib.h" typedef long long ll; ll Bruno( int N, int A[] ){ ll m = 1, ans = 0; for(int i=0; i<N; i+=2){ if(A[i] && A[i+1]){ ans += m*2; } else if(A[i]){ ans += m; } else if(!A[i+1]){ continue; } m *= 3; //fprintf( stderr, "Burnox %IId\n", ans ); } //fprintf( stderr, "Burno %IId\n", ans ); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...