#include "Annalib.h"
#include <bits/stdc++.h>
#define rep(a,b,c) for(int a=b; a<c; a++)
#define repa(a,b) for(auto a: b)
#define repr(a,b,c) for(int a=b-1; a>c-1; a--)
using namespace std;
mt19937_64 rnd(123456789);
void Anna( int N, long long X, int K, int P[] ){
bool b[150]{};
int pp[150];
shuffle(pp,pp+150,rnd);
rep(i,0,K) b[P[i]]=1;
int d[38]{}, p=0;
while(X){
d[p++]=X%3;
X/=3;
}
p=0;
for( int i = 0; i < N; i+=2 ){
if(!b[i] && !b[i+1] && p<38){
if(d[p]==0) Set(pp[i],1), Set(pp[i+1],1); //1,1 = 0
if(d[p]==1) Set(pp[i],1), Set(pp[i+1],0); //1,0 = 1
if(d[p]==2) Set(pp[i],0), Set(pp[i+1],1); //0,1 = 2
p++;
}else Set(pp[i],0), Set(pp[i+1],0);
}
}
#include "Brunolib.h"
#define rep(a,b,c) for(int a=b; a<c; a++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
ll fpow(ll x, ll y){
if(!y) return 1;
if(y&1) return fpow(x,y-1)*x;
ll z=fpow(x,y/2);
return z*z;
}
long long Bruno( int N, int A[] ){
ll d[38]{}, p=0;
ll X=0;
int pp[150];
rep(i,0,150) pp[i]=i;
mt19937_64 rnd(123456789);
rep(i,0,N){
if(A[pp[i]]==0 && A[pp[i+1]]==0){
i++;
continue;
}
if(A[pp[i]]==1 && A[pp[i+1]]==1) d[p++]=0;
if(A[pp[i]]==1 && A[pp[i+1]]==0) d[p++]=1;
if(A[pp[i]]==0 && A[pp[i+1]]==1) d[p++]=2;
i++;
if(p==38) break;
}
rep(i,0,38){
X+=d[i]*fpow(3,i);
}
return X;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
792 KB |
Wrong Answer [1] |
2 |
Incorrect |
0 ms |
800 KB |
Wrong Answer [1] |
3 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
4 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
5 |
Incorrect |
0 ms |
784 KB |
Wrong Answer [1] |
6 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
7 |
Incorrect |
0 ms |
784 KB |
Wrong Answer [1] |
8 |
Incorrect |
1 ms |
796 KB |
Wrong Answer [1] |
9 |
Incorrect |
0 ms |
792 KB |
Wrong Answer [1] |
10 |
Incorrect |
1 ms |
796 KB |
Wrong Answer [1] |
11 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
12 |
Incorrect |
0 ms |
792 KB |
Wrong Answer [1] |
13 |
Incorrect |
0 ms |
792 KB |
Wrong Answer [1] |
14 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
15 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
16 |
Incorrect |
0 ms |
792 KB |
Wrong Answer [1] |
17 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
18 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
19 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
20 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
21 |
Incorrect |
0 ms |
780 KB |
Wrong Answer [1] |
22 |
Incorrect |
1 ms |
1300 KB |
Wrong Answer [1] |
23 |
Incorrect |
1 ms |
788 KB |
Wrong Answer [1] |
24 |
Incorrect |
0 ms |
784 KB |
Wrong Answer [1] |
25 |
Incorrect |
0 ms |
784 KB |
Wrong Answer [1] |
26 |
Incorrect |
0 ms |
784 KB |
Wrong Answer [1] |
27 |
Incorrect |
0 ms |
780 KB |
Wrong Answer [1] |
28 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
29 |
Incorrect |
0 ms |
1292 KB |
Wrong Answer [1] |
30 |
Incorrect |
0 ms |
784 KB |
Wrong Answer [1] |
31 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
32 |
Incorrect |
0 ms |
792 KB |
Wrong Answer [1] |
33 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
34 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
35 |
Incorrect |
0 ms |
780 KB |
Wrong Answer [1] |
36 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
37 |
Incorrect |
1 ms |
780 KB |
Wrong Answer [1] |
38 |
Incorrect |
0 ms |
776 KB |
Wrong Answer [1] |
39 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |
40 |
Incorrect |
0 ms |
796 KB |
Wrong Answer [1] |