# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
261493 | arnold518 | Broken Device (JOI17_broken_device) | C++14 | 59 ms | 3328 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
static const int MAXN = 150;
static const int MAXK = 40;
static int N, K, *P;
static ll X;
static int A[MAXN+10];
static int PP[160];
static int QQ[160];
static int cnt=1;
void Anna(int _N, ll _X, int _K, int _P[])
{
N=_N; X=_X; K=_K; P=_P;
for(int i=0; i<N; i++) PP[i]=i;
srand(8);
random_shuffle(PP, PP+N);
for(int i=0; i<N; i++) QQ[PP[i]]=i;
for(int i=0; i<K; i++) A[QQ[P[i]]]=-1;
ll now=X;
for(int i=0; i<N; i+=2)
{
if(A[i]==-1 && A[i+1]==-1) A[i]=0, A[i+1]=0;
else if(A[i]==-1 && now%3==0) A[i]=0, A[i+1]=1, now/=3;
else if(A[i+1]==-1 && now%3==1) A[i]=1, A[i+1]=0, now/=3;
else if(now%3==0) A[i]=0, A[i+1]=1, now/=3;
else if(now%3==1) A[i]=1, A[i+1]=0, now/=3;
else if(now%3==2) A[i]=1, A[i+1]=1, now/=3;
}
for(int i=0; i<N; i++) Set(PP[i], A[i]);
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
static int N, *A;
static int PP[160];
static int QQ[160];
static int cnt=1;
ll Bruno(int _N, int _A[])
{
N=_N; A=_A;
ll ret=0;
for(int i=0; i<N; i++) PP[i]=i;
srand(8);
random_shuffle(PP, PP+N);
for(int i=0; i<N; i++) QQ[PP[i]]=i;
for(int i=N-2; i>=0; i-=2)
{
if(A[PP[i]]==0 && A[PP[i+1]]==0) continue;
if(A[PP[i]]==0 && A[PP[i+1]]==1) ret=ret*3+0;
if(A[PP[i]]==1 && A[PP[i+1]]==0) ret=ret*3+1;
if(A[PP[i]]==1 && A[PP[i+1]]==1) ret=ret*3+2;
}
return ret;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |