Submission #131569

#TimeUsernameProblemLanguageResultExecution timeMemory
131569zoooma13Broken Device (JOI17_broken_device)C++14
8 / 100
50 ms3312 KiB
#include "bits/stdc++.h" #include "Annalib.h" using namespace std; void Anna( int N, long long X, int K, int P[] ){ X = (X<<1)|1; vector <bool> bad(N, false); for(int i=0; i<K; i++) bad[P[i]] = true; int len = log2(X)+1; for(int i=0; i<N-len+1; i++){ bool ok = true; for(int j=0; j<len; j++) if(bool(X&(1LL<<j)) && bad[i+j]) ok = false; if(ok){ string enc(N ,'0'); for(int j=0; j<len; j++) enc[i+j] ^= bool(X&(1LL<<j)); for(int i=0; i<N; i++) Set(i ,enc[i]=='1'); return; } } for(int i=0; i<N; i++) Set(i ,0); //assert(false); }
#include "bits/stdc++.h" #include "Brunolib.h" using namespace std; long long Bruno( int N, int A[] ){ int st = find(A ,A+N ,1)-A ,en = st; for(int i=st; i<N; i++) if(A[i]) en = i; long long X = 0LL; for(int i=st+1; i<=en; i++) X |= (1LL<<(i-st-1))*A[i]; return X; }
#Verdict Execution timeMemoryGrader output
Fetching results...