#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;
}
Compilation message
Anna.cpp:19:12: warning: 'cnt' defined but not used [-Wunused-variable]
static int cnt=1;
^~~
Bruno.cpp:14:12: warning: 'cnt' defined but not used [-Wunused-variable]
static int cnt=1;
^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
55 ms |
3056 KB |
Output isn't correct - L* = 0 |
2 |
Partially correct |
57 ms |
3056 KB |
Output isn't correct - L* = 0 |
3 |
Partially correct |
55 ms |
3056 KB |
Output isn't correct - L* = 0 |
4 |
Partially correct |
55 ms |
3072 KB |
Output isn't correct - L* = 0 |
5 |
Partially correct |
56 ms |
3056 KB |
Output isn't correct - L* = 0 |
6 |
Partially correct |
55 ms |
3072 KB |
Output isn't correct - L* = 0 |
7 |
Partially correct |
54 ms |
3120 KB |
Output isn't correct - L* = 0 |
8 |
Partially correct |
54 ms |
3072 KB |
Output isn't correct - L* = 0 |
9 |
Partially correct |
56 ms |
3072 KB |
Output isn't correct - L* = 0 |
10 |
Partially correct |
55 ms |
3056 KB |
Output isn't correct - L* = 0 |
11 |
Partially correct |
56 ms |
3064 KB |
Output isn't correct - L* = 0 |
12 |
Partially correct |
54 ms |
3056 KB |
Output isn't correct - L* = 0 |
13 |
Partially correct |
53 ms |
3072 KB |
Output isn't correct - L* = 0 |
14 |
Partially correct |
55 ms |
3056 KB |
Output isn't correct - L* = 0 |
15 |
Partially correct |
54 ms |
3056 KB |
Output isn't correct - L* = 0 |
16 |
Partially correct |
57 ms |
2904 KB |
Output isn't correct - L* = 0 |
17 |
Partially correct |
54 ms |
3072 KB |
Output isn't correct - L* = 0 |
18 |
Partially correct |
55 ms |
3072 KB |
Output isn't correct - L* = 0 |
19 |
Partially correct |
56 ms |
3328 KB |
Output isn't correct - L* = 0 |
20 |
Partially correct |
54 ms |
3056 KB |
Output isn't correct - L* = 0 |
21 |
Partially correct |
54 ms |
3056 KB |
Output isn't correct - L* = 0 |
22 |
Partially correct |
55 ms |
3072 KB |
Output isn't correct - L* = 0 |
23 |
Partially correct |
54 ms |
3056 KB |
Output isn't correct - L* = 0 |
24 |
Partially correct |
55 ms |
3056 KB |
Output isn't correct - L* = 0 |
25 |
Partially correct |
55 ms |
3072 KB |
Output isn't correct - L* = 0 |
26 |
Partially correct |
55 ms |
3056 KB |
Output isn't correct - L* = 0 |
27 |
Partially correct |
54 ms |
3056 KB |
Output isn't correct - L* = 0 |
28 |
Partially correct |
54 ms |
3072 KB |
Output isn't correct - L* = 0 |
29 |
Partially correct |
54 ms |
3072 KB |
Output isn't correct - L* = 0 |
30 |
Partially correct |
56 ms |
3072 KB |
Output isn't correct - L* = 0 |
31 |
Partially correct |
55 ms |
3072 KB |
Output isn't correct - L* = 0 |
32 |
Partially correct |
59 ms |
3064 KB |
Output isn't correct - L* = 0 |
33 |
Partially correct |
54 ms |
3072 KB |
Output isn't correct - L* = 0 |
34 |
Partially correct |
57 ms |
3072 KB |
Output isn't correct - L* = 0 |
35 |
Partially correct |
54 ms |
3072 KB |
Output isn't correct - L* = 0 |
36 |
Partially correct |
55 ms |
3072 KB |
Output isn't correct - L* = 0 |
37 |
Partially correct |
55 ms |
3072 KB |
Output isn't correct - L* = 0 |
38 |
Partially correct |
55 ms |
3072 KB |
Output isn't correct - L* = 0 |
39 |
Partially correct |
54 ms |
3056 KB |
Output isn't correct - L* = 0 |
40 |
Partially correct |
54 ms |
3072 KB |
Output isn't correct - L* = 0 |