# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
100074 | SomeoneUnknown | Broken Device (JOI17_broken_device) | C++14 | 75 ms | 3144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |