#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;
void Anna( int N, long long X, int K, int P[] ){
bool b[150]{};
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(i,1), Set(i+1,1); //1,1 = 0
if(d[p]==1) Set(i,1), Set(i+1,0); //1,0 = 1
if(d[p]==2) Set(i,0), Set(i+1,1); //0,1 = 2
p++;
}else Set(i,0), Set(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;
rep(i,0,N){
if(A[i]==0 && A[i+1]==0){
i++;
continue;
}
if(A[i]==1 && A[i+1]==1) d[p++]=0;
if(A[i]==1 && A[i+1]==0) d[p++]=1;
if(A[i]==0 && A[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 |
31 ms |
2396 KB |
Output is partially correct - L* = 37 |
2 |
Partially correct |
28 ms |
2396 KB |
Output is partially correct - L* = 37 |
3 |
Partially correct |
26 ms |
2392 KB |
Output is partially correct - L* = 37 |
4 |
Partially correct |
27 ms |
2408 KB |
Output is partially correct - L* = 37 |
5 |
Partially correct |
27 ms |
2308 KB |
Output is partially correct - L* = 37 |
6 |
Partially correct |
27 ms |
2396 KB |
Output is partially correct - L* = 37 |
7 |
Partially correct |
27 ms |
2404 KB |
Output is partially correct - L* = 37 |
8 |
Partially correct |
28 ms |
2396 KB |
Output is partially correct - L* = 37 |
9 |
Partially correct |
27 ms |
2372 KB |
Output is partially correct - L* = 37 |
10 |
Partially correct |
27 ms |
2400 KB |
Output is partially correct - L* = 37 |
11 |
Partially correct |
26 ms |
2392 KB |
Output is partially correct - L* = 37 |
12 |
Partially correct |
26 ms |
2524 KB |
Output is partially correct - L* = 37 |
13 |
Partially correct |
26 ms |
2488 KB |
Output is partially correct - L* = 37 |
14 |
Partially correct |
27 ms |
2372 KB |
Output is partially correct - L* = 37 |
15 |
Partially correct |
27 ms |
2304 KB |
Output is partially correct - L* = 37 |
16 |
Partially correct |
27 ms |
2396 KB |
Output is partially correct - L* = 37 |
17 |
Partially correct |
27 ms |
2724 KB |
Output is partially correct - L* = 37 |
18 |
Partially correct |
27 ms |
2392 KB |
Output is partially correct - L* = 37 |
19 |
Partially correct |
26 ms |
2396 KB |
Output is partially correct - L* = 37 |
20 |
Partially correct |
27 ms |
2404 KB |
Output is partially correct - L* = 37 |
21 |
Partially correct |
26 ms |
2396 KB |
Output is partially correct - L* = 37 |
22 |
Partially correct |
26 ms |
2468 KB |
Output is partially correct - L* = 37 |
23 |
Partially correct |
26 ms |
2400 KB |
Output is partially correct - L* = 37 |
24 |
Partially correct |
26 ms |
2392 KB |
Output is partially correct - L* = 37 |
25 |
Partially correct |
26 ms |
2396 KB |
Output is partially correct - L* = 37 |
26 |
Partially correct |
28 ms |
2492 KB |
Output is partially correct - L* = 37 |
27 |
Partially correct |
32 ms |
2392 KB |
Output is partially correct - L* = 37 |
28 |
Partially correct |
28 ms |
2404 KB |
Output is partially correct - L* = 37 |
29 |
Partially correct |
31 ms |
2628 KB |
Output is partially correct - L* = 37 |
30 |
Partially correct |
29 ms |
2392 KB |
Output is partially correct - L* = 37 |
31 |
Partially correct |
27 ms |
2332 KB |
Output is partially correct - L* = 37 |
32 |
Partially correct |
27 ms |
2400 KB |
Output is partially correct - L* = 37 |
33 |
Partially correct |
27 ms |
2392 KB |
Output is partially correct - L* = 37 |
34 |
Partially correct |
31 ms |
2924 KB |
Output is partially correct - L* = 37 |
35 |
Partially correct |
31 ms |
2372 KB |
Output is partially correct - L* = 37 |
36 |
Partially correct |
27 ms |
2392 KB |
Output is partially correct - L* = 37 |
37 |
Partially correct |
27 ms |
2396 KB |
Output is partially correct - L* = 37 |
38 |
Partially correct |
26 ms |
2404 KB |
Output is partially correct - L* = 37 |
39 |
Partially correct |
27 ms |
2408 KB |
Output is partially correct - L* = 37 |
40 |
Partially correct |
27 ms |
2396 KB |
Output is partially correct - L* = 37 |