# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
549265 | brunnorezendes | Broken Device (JOI17_broken_device) | C++14 | 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 <bits/stdc++.h>
#include "Annalib.h"
using namespace std;
typedef long long int ll;
typedef vector <int> vi;
void Anna(int n, ll x, int k, vi p){
int cont=0, i, bits=0;
for(i=0;i<n;i++){
if(cont<k && p[cont]==i){
cont++;
Set(i, 0);
continue;
}
if((1<<bits)>x) continue;
if(x&(1<<bits)){
if(cont<k && p[cont]==i+1){
Set(i, 0);
continue;
}
else{
Set(i, 1);
if(i<n-1) Set(i+1, 1);
i++;
}
}
else{
Set(i, 1);
if(i<n-1) Set(i+1, 0);
if(cont<k && p[cont]==i+1) cont++;
i++;
}
bits++;
}
}
#include <bits/stdc++.h>
#include "Brunolib.h"
using namespace std;
typedef vector <int> vi;
typedef long long int ll;
ll Bruno(int n, vi a){
ll x=0;
int bits=0;
for(int i=0;i<n;i++){
if(a[i]){
if(i==n-1 || a[i+1]) x+=(ll)(1<<bits);
i++;
bits++;
}
}
return (x);
}