# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
561583 | amunduzbaev | Broken Device (JOI17_broken_device) | C++17 | 0 ms | 0 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 "Brunolib.h"
#include "bits/stdc++.h"
using namespace std;
long long Bruno( int n, int a[] ){
int b = 1, l = -1;
const int M = 4;
int val = 0, t = 0;
for(int i=0;i<n && t < M;i++){
if(!a[i]) continue;
if(a[i]){
val |= (a[i + 1] << t);
t++, i++, l = i + 1;
}
}
if(l == -1) return 0ll;
b = val + 1;
int bit = 0;
long long x = 0;
for(int i=l;i<n;i++){
if(a[i]){
for(int j=i+1;j<=i+b && bit < 60;j++){
x |= ((a[j] * 1ll) << bit);
bit++;
}
i += b;
}
}
//~ cout<<x<<endl;
return x;
}