/// Author: Wang, Yen-Jen
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
static bool A[150];
static bool B[150];
static int cnt[50];
static bool st[150];
inline static void my_set(int p , int a , int b , int c) {
B[p * 3] = a;
B[p * 3 + 1] = b;
B[p * 3 + 2] = c;
}
void Anna(int N , long long X , int K , int P[]) {
memset(st , 0 , sizeof(st));
memset(cnt , 0 , sizeof(cnt));
for(int i = 0; i < K; i++) {
st[P[i]] = 1;
cnt[P[i] / 3]++;
}
memset(A , 0 , sizeof(A));
for(int i = 0; i < 60; i++) {
A[i] = (X&1);
X >>= 1;
}
int cc = 0;
memset(B , 0 , sizeof(B));
for(int i = 0; i < N / 3; i++) {
if(cnt[i] >= 2) continue;
if(cnt[i] == 0) {
if(A[cc]) {
if(A[cc + 1]) my_set(i , 1 , 1 , 1);
else my_set(i , 0 , 1 , 1);
}
else {
if(A[cc + 1]) my_set(i , 1 , 1 , 0);
else my_set(i , 1 , 0 , 1);
}
cc += 2;
}
else {
if(st[i * 3]) {
if(A[cc] && !A[cc + 1]) {
my_set(i , 0 , 1 , 1);
cc += 2;
}
else {
if(A[cc]) my_set(i , 0 , 1 , 0);
else my_set(i , 0 , 0 , 1);
cc++;
}
}
else if(st[i * 3 + 1]) {
if(!A[cc] && !A[cc + 1]) {
my_set(i , 1 , 0 , 1);
cc += 2;
}
else if(!A[cc]) {
my_set(i , 0 , 0 , 1);
cc++;
}
}
else {
if(!A[cc] && A[cc + 1]) {
my_set(i , 1 , 1 , 0);
cc += 2;
}
else if(A[cc]) {
my_set(i , 0 , 1 , 0);
cc++;
}
}
}
}
for(int i = 0; i < N; i++) Set(i , B[i]);
}
/// Author: Wang, Yen-Jen
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
static int B[150];
long long Bruno(int N , int A[]) {
long long X = 0;
int cc = 0;
for(int i = 0; i < N / 3; i++) {
if(!(A[i * 3] || A[i * 3 + 1] || A[i * 3 + 2])) continue;
if(A[i * 3]) {
if(A[i * 3 + 1]) {
if(A[i * 3 + 2]) B[cc++] = 1 , B[cc++] = 1;
else B[cc++] = 0 , B[cc++] = 1;
}
else {
if(A[i * 3 + 2]) B[cc++] = 0 , B[cc++] = 0;
else B[cc++] = 0 , B[cc++] = 0;
}
}
else {
if(A[i * 3 + 1]) {
if(A[i * 3 + 2]) B[cc++] = 1 , B[cc++] = 0;
else B[cc++] = 1;
}
else {
if(A[i * 3 + 2]) B[cc++] = 0;
}
}
}
for(int i = 0; i < 60; i++) X |= ((long long)B[i]<<i);
return X;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
41 ms |
4640 KB |
Output is partially correct - L* = 23 |
2 |
Partially correct |
41 ms |
4640 KB |
Output is partially correct - L* = 21 |
3 |
Partially correct |
42 ms |
4640 KB |
Output is partially correct - L* = 20 |
4 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 21 |
5 |
Partially correct |
41 ms |
4640 KB |
Output is partially correct - L* = 20 |
6 |
Partially correct |
41 ms |
4640 KB |
Output is partially correct - L* = 20 |
7 |
Partially correct |
35 ms |
4640 KB |
Output is partially correct - L* = 20 |
8 |
Partially correct |
48 ms |
4640 KB |
Output is partially correct - L* = 20 |
9 |
Partially correct |
38 ms |
4640 KB |
Output is partially correct - L* = 22 |
10 |
Partially correct |
39 ms |
4640 KB |
Output is partially correct - L* = 20 |
11 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 21 |
12 |
Partially correct |
45 ms |
4640 KB |
Output is partially correct - L* = 22 |
13 |
Partially correct |
35 ms |
4640 KB |
Output is partially correct - L* = 21 |
14 |
Partially correct |
36 ms |
4640 KB |
Output is partially correct - L* = 22 |
15 |
Partially correct |
49 ms |
4640 KB |
Output is partially correct - L* = 20 |
16 |
Partially correct |
35 ms |
4640 KB |
Output is partially correct - L* = 21 |
17 |
Partially correct |
52 ms |
4640 KB |
Output is partially correct - L* = 21 |
18 |
Partially correct |
45 ms |
4640 KB |
Output is partially correct - L* = 24 |
19 |
Partially correct |
52 ms |
4640 KB |
Output is partially correct - L* = 21 |
20 |
Partially correct |
46 ms |
4640 KB |
Output is partially correct - L* = 20 |
21 |
Partially correct |
52 ms |
4640 KB |
Output is partially correct - L* = 21 |
22 |
Partially correct |
52 ms |
4640 KB |
Output is partially correct - L* = 20 |
23 |
Partially correct |
45 ms |
4640 KB |
Output is partially correct - L* = 21 |
24 |
Partially correct |
38 ms |
4640 KB |
Output is partially correct - L* = 21 |
25 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 20 |
26 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 20 |
27 |
Partially correct |
39 ms |
4640 KB |
Output is partially correct - L* = 22 |
28 |
Partially correct |
54 ms |
4640 KB |
Output is partially correct - L* = 21 |
29 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 23 |
30 |
Partially correct |
35 ms |
4640 KB |
Output is partially correct - L* = 21 |
31 |
Partially correct |
35 ms |
4640 KB |
Output is partially correct - L* = 22 |
32 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 23 |
33 |
Partially correct |
49 ms |
4640 KB |
Output is partially correct - L* = 20 |
34 |
Partially correct |
62 ms |
4640 KB |
Output is partially correct - L* = 22 |
35 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 20 |
36 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 23 |
37 |
Partially correct |
41 ms |
4640 KB |
Output is partially correct - L* = 20 |
38 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 22 |
39 |
Partially correct |
41 ms |
4640 KB |
Output is partially correct - L* = 20 |
40 |
Partially correct |
32 ms |
4640 KB |
Output is partially correct - L* = 21 |