# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100074 | SomeoneUnknown | Broken Device (JOI17_broken_device) | C++14 | 75 ms | 3144 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[] ){
long long xpr = X;
int pptr = 0;
for( int i = 0; i < N; i+=3 ){
//Set( i, 0 );
int corrcount = 0;
bool corecorr = false;
int lm3 = xpr%3;
while(pptr < K && P[pptr] < i+3){
if(P[pptr] == i+lm3) corecorr = true;
corrcount++;
pptr++;
}
if(corrcount>1){
for(int j = 0; j < 3; j++)
Set(i+j, 0);
continue;
}
if(corecorr){
for(int j = 0; j < 3; j++)
Set(i+j, j!=lm3);
}else{
for(int j = 0; j < 3; j++)
Set(i+j, j==lm3);
}
xpr /= 3;
}
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
long long Bruno( int N, int A[] ){
//printf("\n");
long long res = 0;
int p0 = 0;
int p1 = 0;
for(int i = N-3; i >= 0; i-=3){
int clean = 0;
for(int j = 0; j < 3; j++){
if(A[i+j] == 1){
clean++;
//printf("-%d %d\n", i+j, clean);
p1 = j;
}else{
p0=j;
}
}
if(clean == 0) continue;
//printf("%d ", clean);
if(clean == 1){
res *= 3;
res += p1;
}else{
res *= 3;
res += p0;
}
//printf("%lld\n", res);
}
return res;
}
/*
2
15 14 1
2
15 9 2
0 1
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |