# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131563 | zoooma13 | Broken Device (JOI17_broken_device) | C++14 | 3 ms | 508 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
}
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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |