#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];
rep(i,0,150) pp[i]=i;
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 |
Partially correct |
22 ms |
2764 KB |
Output isn't correct - L* = 0 |
2 |
Partially correct |
22 ms |
2764 KB |
Output isn't correct - L* = 0 |
3 |
Partially correct |
22 ms |
2796 KB |
Output isn't correct - L* = 0 |
4 |
Partially correct |
23 ms |
2736 KB |
Output isn't correct - L* = 0 |
5 |
Partially correct |
22 ms |
2756 KB |
Output isn't correct - L* = 0 |
6 |
Partially correct |
26 ms |
3240 KB |
Output isn't correct - L* = 0 |
7 |
Partially correct |
23 ms |
2760 KB |
Output isn't correct - L* = 0 |
8 |
Partially correct |
24 ms |
2840 KB |
Output isn't correct - L* = 0 |
9 |
Partially correct |
22 ms |
2660 KB |
Output isn't correct - L* = 0 |
10 |
Partially correct |
22 ms |
2760 KB |
Output isn't correct - L* = 0 |
11 |
Partially correct |
23 ms |
2620 KB |
Output isn't correct - L* = 0 |
12 |
Partially correct |
22 ms |
2760 KB |
Output isn't correct - L* = 0 |
13 |
Partially correct |
23 ms |
2844 KB |
Output isn't correct - L* = 0 |
14 |
Partially correct |
23 ms |
2840 KB |
Output isn't correct - L* = 0 |
15 |
Partially correct |
23 ms |
2748 KB |
Output isn't correct - L* = 0 |
16 |
Partially correct |
22 ms |
2760 KB |
Output isn't correct - L* = 0 |
17 |
Partially correct |
22 ms |
2768 KB |
Output isn't correct - L* = 0 |
18 |
Partially correct |
22 ms |
2756 KB |
Output isn't correct - L* = 0 |
19 |
Partially correct |
22 ms |
2756 KB |
Output isn't correct - L* = 0 |
20 |
Partially correct |
22 ms |
2764 KB |
Output isn't correct - L* = 0 |
21 |
Partially correct |
23 ms |
2756 KB |
Output isn't correct - L* = 0 |
22 |
Partially correct |
23 ms |
2848 KB |
Output isn't correct - L* = 0 |
23 |
Partially correct |
28 ms |
2732 KB |
Output isn't correct - L* = 0 |
24 |
Partially correct |
22 ms |
2760 KB |
Output isn't correct - L* = 0 |
25 |
Partially correct |
23 ms |
2760 KB |
Output isn't correct - L* = 0 |
26 |
Partially correct |
23 ms |
2736 KB |
Output isn't correct - L* = 0 |
27 |
Partially correct |
22 ms |
2756 KB |
Output isn't correct - L* = 0 |
28 |
Partially correct |
22 ms |
2756 KB |
Output isn't correct - L* = 0 |
29 |
Partially correct |
22 ms |
2760 KB |
Output isn't correct - L* = 0 |
30 |
Partially correct |
23 ms |
2824 KB |
Output isn't correct - L* = 0 |
31 |
Partially correct |
29 ms |
2764 KB |
Output isn't correct - L* = 0 |
32 |
Partially correct |
24 ms |
2660 KB |
Output isn't correct - L* = 0 |
33 |
Partially correct |
23 ms |
2752 KB |
Output isn't correct - L* = 0 |
34 |
Partially correct |
28 ms |
2604 KB |
Output isn't correct - L* = 0 |
35 |
Partially correct |
23 ms |
2760 KB |
Output isn't correct - L* = 0 |
36 |
Partially correct |
23 ms |
2776 KB |
Output isn't correct - L* = 0 |
37 |
Partially correct |
24 ms |
2760 KB |
Output isn't correct - L* = 0 |
38 |
Partially correct |
22 ms |
2752 KB |
Output isn't correct - L* = 0 |
39 |
Partially correct |
22 ms |
2756 KB |
Output isn't correct - L* = 0 |
40 |
Partially correct |
22 ms |
2776 KB |
Output isn't correct - L* = 0 |