# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1077172 | AMO5 | Broken Device (JOI17_broken_device) | C++17 | 27 ms | 2904 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"
void Anna( int N, long long X, int K, int P[] ){
std::vector<int>bad(N, 0);
for(int i=0; i<K; i++)bad[P[i]]=1;
long long tmp = X;
for(int i=0; i<N; i+=2){
if(bad[i] || (i + 1 < N && bad[i+1]) || tmp == 0){
Set(i, 0);
Set(i+1, 0);
}else{
int bit = tmp % 3;
if(bit == 0){
Set(i, 0);
Set(i+1, 1);
}else{
Set(i, 1);
Set(i+1, bit - 1);
}
tmp /= 3;
}
}
}
#include "Brunolib.h"
#include "bits/stdc++.h"
long long Bruno( int N, int A[] ){
std::vector<int>bits;
for(int i=0; i<N; i+=2){
if(A[i] == 0){
if(A[i+1] == 1)bits.emplace_back(0);
}else{
bits.emplace_back(A[i+1]+1);
}
}
long long answer = 0LL;
while(!bits.empty()){
answer *= 3LL;
answer += bits.back();
bits.pop_back();
}
return answer;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |