# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
954896 | leo_2727 | Broken Device (JOI17_broken_device) | C++17 | 32 ms | 2900 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>
typedef long long ll;
using namespace std;
void Anna( int N, ll X, int K, int P[] ){
int ar[N]={0}, s[60]={0};
for(int i=0;i<60;i++)
if(X & ((ll)1<<i)) s[i]=1;
for(int i=0;i<K;i++) ar[P[i]]=-1;
int curr=0;
for(int i=0;i<N;i++){
if(curr>59 || ar[i]==-1) continue;
if(s[curr]==1 && ar[i+1]==-1) continue;
if(s[curr+1]==1 && ar[i+2]==-1) continue;
ar[i]=1;
ar[i+1]=s[curr++];
ar[i+2]=s[curr++];
i+=2;
}
for(int i=0;i<N;i++)
(ar[i]==1) ? Set(i, 1) : Set(i, 0);
}
#include <bits/stdc++.h>
#include <Brunolib.h>
typedef long long ll;
using namespace std;
ll Bruno(int N, int A[]){
ll ans=0, curr=0;
for(int i=0;i<N;i++){
if(A[i]==1){
if(A[i+1]==1) ans|=((ll)1<<curr);
curr++;
if(A[i+2]==1) ans|=((ll)1<<curr);
curr++;
i+=2;
if(curr>59) break;
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |