# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
954891 | Skywk | Broken Device (JOI17_broken_device) | C++14 | 1 ms | 604 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 "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
void Anna(int N, long long X, int K, int P[]){
vector<int> A(N), B(N);
for(int i=0; i<K; i++){
B[P[i]] = 1;
}
for(int i=0, j=0; (1 << j) <= X;){
if(B[i]){
i++;
continue;
}
if(B[i + 1]){
if((X >> j) & 1){
i += 2;
continue;
}
}
A[i] = 1;
A[i + 1] = (X >> j) & 1;
j++;
i += 2;
}
for(int i=0; i<N; i++){
Set(i, A[i]);
}
}
#include "Brunolib.h"
long long Bruno(int N, int A[]){
long long X = 0;
int cntBits = 0;
for(int i=0; i<N; i++){
if(A[i] == 1){
cntBits++;
i++;
}
}
for(int i=0, j=0; j < cntBits;){
if(A[i]){
if(A[i + 1]) X += (1LL << j);
j++;
i += 2;
}
else{
i++;
}
}
return X;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |