#include "Anthony.h"
#include <bits/stdc++.h>
namespace {
std::vector<std::vector<int>> edges;
std::map<std::pair<int,int>,int> eids;
std::vector<int> marks;
void dfs(int cur,int parent,int prog){
if(cur!=0)marks[eids[{cur,parent}]]=(13>>(prog%6))&1;
int oldm=(13>>(prog%6))&1;
int nprog=edges[cur].size()==2?prog+1:oldm?4:0;
for(int i:edges[cur]){
if(i==parent)continue;
dfs(i,cur,nprog);
}
}
} // namespace
/*
DFS tree?
101100 away from node 0
001101 along the branches of the tree - if you are going the wrong way, it will be reversed
001101
01100
11001
10010
00101
01011
10110
all appear only in reverse
If you see one of the rotations of it, go back the other way
*/
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
marks.resize(M);
edges.resize(N);
for(int i=0;i<M;i++){
eids[{U[i],V[i]}]=i;
eids[{V[i],U[i]}]=i;
edges[U[i]].push_back(V[i]);
edges[V[i]].push_back(U[i]);
}
dfs(0,0,0);
//for(int i:marks)std::cout<<i<<'\n';
return marks;
}
#include "Catherine.h"
#include <bits/stdc++.h>
namespace {
int num=0;
int last6=-1;
int last=0;
} // namespace
/*
001101
*/
void Init(int A, int B) {
}
int Move(std::vector<int> y) {
/*
std::cout<<"move "<<last<<'\n';
std::cout<<last6<<'\n';
std::cout<<"seen\n";
for(int i:y){
std::cout<<i<<' ';
}
std::cout<<'\n';
*/
if(num==0){
if(y[0]+y[1]==2){
if(y[1]==0){
last6=0;
last=0;
}else if(y[1]==1){
last6=1;
last=1;
}else if(y[1]==2){
last6=3;
last=1;
}
num=2;
return last;//don't care
}else{
num=-1e9;
last=y[1]==1;
return last;//what appears once
}
}
if(y[0]+y[1]>=2){
num=-1e9;
int n=y[1];
int move;
if(y[0]==0||y[1]==0)move=-1;
else if((y[0]+!last)==1)move=0;
else move=1;
last=move==-1?last:move;
return move;
}else if(y[0]+y[1]==1){
last6<<=1;last6+=y[1];num++;
if(num==5){
if(last6==12||last6==25||last6==18||last6==5||last6==11||last6==22){
num=-1e9;
last=last;
return -1;
}
}
last=y[1];
return last;
}else{
num=-1e9;last=last;
return -1;
}
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:49:13: warning: unused variable 'n' [-Wunused-variable]
49 | int n=y[1];
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
44 ms |
18712 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
44 ms |
18712 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
16500 KB |
Output is correct |
2 |
Correct |
1 ms |
776 KB |
Output is correct |
3 |
Correct |
34 ms |
15564 KB |
Output is correct |
4 |
Correct |
46 ms |
18688 KB |
Output is correct |
5 |
Correct |
47 ms |
18784 KB |
Output is correct |
6 |
Incorrect |
37 ms |
16468 KB |
Wrong Answer [6] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
16500 KB |
Output is correct |
2 |
Correct |
1 ms |
776 KB |
Output is correct |
3 |
Correct |
34 ms |
15564 KB |
Output is correct |
4 |
Correct |
46 ms |
18688 KB |
Output is correct |
5 |
Correct |
47 ms |
18784 KB |
Output is correct |
6 |
Incorrect |
37 ms |
16468 KB |
Wrong Answer [6] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1044 KB |
Output is correct |
2 |
Correct |
0 ms |
784 KB |
Output is correct |
3 |
Correct |
1 ms |
1048 KB |
Output is correct |
4 |
Correct |
1 ms |
1056 KB |
Output is correct |
5 |
Correct |
1 ms |
1048 KB |
Output is correct |
6 |
Correct |
2 ms |
1052 KB |
Output is correct |
7 |
Correct |
2 ms |
1052 KB |
Output is correct |
8 |
Correct |
2 ms |
1048 KB |
Output is correct |
9 |
Correct |
2 ms |
1056 KB |
Output is correct |
10 |
Correct |
1 ms |
1052 KB |
Output is correct |
11 |
Correct |
1 ms |
1056 KB |
Output is correct |
12 |
Correct |
2 ms |
1056 KB |
Output is correct |
13 |
Correct |
1 ms |
1048 KB |
Output is correct |
14 |
Correct |
1 ms |
1048 KB |
Output is correct |
15 |
Correct |
2 ms |
1056 KB |
Output is correct |
16 |
Correct |
1 ms |
1048 KB |
Output is correct |
17 |
Correct |
1 ms |
1056 KB |
Output is correct |
18 |
Correct |
2 ms |
1052 KB |
Output is correct |
19 |
Correct |
2 ms |
1048 KB |
Output is correct |
20 |
Correct |
1 ms |
1056 KB |
Output is correct |
21 |
Correct |
1 ms |
1056 KB |
Output is correct |
22 |
Correct |
2 ms |
1056 KB |
Output is correct |
23 |
Correct |
2 ms |
1056 KB |
Output is correct |
24 |
Correct |
2 ms |
1060 KB |
Output is correct |
25 |
Correct |
1 ms |
1056 KB |
Output is correct |
26 |
Correct |
1 ms |
1056 KB |
Output is correct |
27 |
Correct |
2 ms |
1056 KB |
Output is correct |
28 |
Correct |
1 ms |
1048 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
13592 KB |
Output is correct |
2 |
Correct |
43 ms |
15720 KB |
Output is correct |
3 |
Correct |
1 ms |
1044 KB |
Output is correct |
4 |
Correct |
32 ms |
13944 KB |
Output is correct |
5 |
Correct |
47 ms |
17228 KB |
Output is correct |
6 |
Correct |
44 ms |
17192 KB |
Output is correct |
7 |
Correct |
45 ms |
16372 KB |
Output is correct |
8 |
Correct |
37 ms |
16208 KB |
Output is correct |
9 |
Correct |
50 ms |
17136 KB |
Output is correct |
10 |
Correct |
41 ms |
17224 KB |
Output is correct |
11 |
Correct |
45 ms |
17260 KB |
Output is correct |
12 |
Correct |
44 ms |
17136 KB |
Output is correct |
13 |
Correct |
47 ms |
17356 KB |
Output is correct |
14 |
Correct |
45 ms |
17248 KB |
Output is correct |
15 |
Correct |
48 ms |
17140 KB |
Output is correct |
16 |
Correct |
40 ms |
17184 KB |
Output is correct |
17 |
Correct |
41 ms |
16976 KB |
Output is correct |
18 |
Correct |
46 ms |
16816 KB |
Output is correct |
19 |
Correct |
41 ms |
16888 KB |
Output is correct |
20 |
Correct |
41 ms |
16884 KB |
Output is correct |
21 |
Correct |
41 ms |
16884 KB |
Output is correct |
22 |
Correct |
44 ms |
16968 KB |
Output is correct |
23 |
Correct |
39 ms |
14136 KB |
Output is correct |
24 |
Correct |
38 ms |
14076 KB |
Output is correct |
25 |
Correct |
39 ms |
14944 KB |
Output is correct |
26 |
Correct |
47 ms |
14848 KB |
Output is correct |
27 |
Correct |
40 ms |
15672 KB |
Output is correct |
28 |
Correct |
47 ms |
15788 KB |
Output is correct |
29 |
Correct |
45 ms |
15608 KB |
Output is correct |
30 |
Correct |
44 ms |
15656 KB |
Output is correct |
31 |
Correct |
35 ms |
14140 KB |
Output is correct |
32 |
Correct |
39 ms |
14256 KB |
Output is correct |
33 |
Correct |
41 ms |
14656 KB |
Output is correct |
34 |
Correct |
44 ms |
14648 KB |
Output is correct |
35 |
Correct |
45 ms |
15440 KB |
Output is correct |
36 |
Correct |
41 ms |
15628 KB |
Output is correct |
37 |
Correct |
44 ms |
15432 KB |
Output is correct |
38 |
Correct |
40 ms |
15536 KB |
Output is correct |
39 |
Correct |
43 ms |
15548 KB |
Output is correct |
40 |
Correct |
40 ms |
15380 KB |
Output is correct |
41 |
Correct |
40 ms |
16448 KB |
Output is correct |
42 |
Correct |
53 ms |
16124 KB |
Output is correct |
43 |
Correct |
43 ms |
16192 KB |
Output is correct |
44 |
Correct |
43 ms |
16316 KB |
Output is correct |
45 |
Correct |
41 ms |
16368 KB |
Output is correct |
46 |
Correct |
40 ms |
16120 KB |
Output is correct |
47 |
Correct |
41 ms |
15220 KB |
Output is correct |
48 |
Correct |
44 ms |
15480 KB |
Output is correct |
49 |
Correct |
41 ms |
15172 KB |
Output is correct |
50 |
Correct |
40 ms |
15344 KB |
Output is correct |
51 |
Correct |
37 ms |
14424 KB |
Output is correct |
52 |
Correct |
39 ms |
14412 KB |
Output is correct |
53 |
Correct |
37 ms |
14400 KB |
Output is correct |
54 |
Correct |
35 ms |
14380 KB |
Output is correct |
55 |
Correct |
38 ms |
14352 KB |
Output is correct |
56 |
Correct |
47 ms |
14300 KB |
Output is correct |
57 |
Correct |
39 ms |
14348 KB |
Output is correct |
58 |
Correct |
39 ms |
14460 KB |
Output is correct |
59 |
Correct |
44 ms |
14408 KB |
Output is correct |
60 |
Correct |
38 ms |
14324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
13492 KB |
Output is correct |
2 |
Correct |
42 ms |
15464 KB |
Output is correct |
3 |
Correct |
0 ms |
792 KB |
Output is correct |
4 |
Correct |
34 ms |
13868 KB |
Output is correct |
5 |
Correct |
44 ms |
17232 KB |
Output is correct |
6 |
Correct |
45 ms |
17228 KB |
Output is correct |
7 |
Correct |
40 ms |
16476 KB |
Output is correct |
8 |
Correct |
41 ms |
16212 KB |
Output is correct |
9 |
Correct |
40 ms |
17240 KB |
Output is correct |
10 |
Correct |
40 ms |
17688 KB |
Output is correct |
11 |
Correct |
41 ms |
17224 KB |
Output is correct |
12 |
Correct |
43 ms |
17188 KB |
Output is correct |
13 |
Correct |
52 ms |
17144 KB |
Output is correct |
14 |
Correct |
40 ms |
17252 KB |
Output is correct |
15 |
Correct |
45 ms |
17256 KB |
Output is correct |
16 |
Correct |
46 ms |
17400 KB |
Output is correct |
17 |
Correct |
46 ms |
16788 KB |
Output is correct |
18 |
Correct |
41 ms |
17000 KB |
Output is correct |
19 |
Correct |
45 ms |
16896 KB |
Output is correct |
20 |
Correct |
40 ms |
16860 KB |
Output is correct |
21 |
Correct |
47 ms |
16872 KB |
Output is correct |
22 |
Correct |
40 ms |
16988 KB |
Output is correct |
23 |
Correct |
38 ms |
14136 KB |
Output is correct |
24 |
Correct |
39 ms |
14052 KB |
Output is correct |
25 |
Correct |
45 ms |
14832 KB |
Output is correct |
26 |
Correct |
41 ms |
14924 KB |
Output is correct |
27 |
Correct |
41 ms |
15692 KB |
Output is correct |
28 |
Correct |
41 ms |
15540 KB |
Output is correct |
29 |
Correct |
45 ms |
15724 KB |
Output is correct |
30 |
Correct |
45 ms |
15676 KB |
Output is correct |
31 |
Correct |
38 ms |
14092 KB |
Output is correct |
32 |
Correct |
40 ms |
14148 KB |
Output is correct |
33 |
Correct |
37 ms |
14940 KB |
Output is correct |
34 |
Correct |
39 ms |
14676 KB |
Output is correct |
35 |
Correct |
38 ms |
15448 KB |
Output is correct |
36 |
Correct |
39 ms |
15436 KB |
Output is correct |
37 |
Correct |
44 ms |
15428 KB |
Output is correct |
38 |
Correct |
44 ms |
15548 KB |
Output is correct |
39 |
Correct |
46 ms |
15348 KB |
Output is correct |
40 |
Correct |
41 ms |
15448 KB |
Output is correct |
41 |
Correct |
47 ms |
16212 KB |
Output is correct |
42 |
Correct |
41 ms |
16060 KB |
Output is correct |
43 |
Correct |
41 ms |
16116 KB |
Output is correct |
44 |
Correct |
44 ms |
16124 KB |
Output is correct |
45 |
Correct |
43 ms |
16124 KB |
Output is correct |
46 |
Correct |
40 ms |
16216 KB |
Output is correct |
47 |
Correct |
38 ms |
15436 KB |
Output is correct |
48 |
Correct |
48 ms |
15440 KB |
Output is correct |
49 |
Correct |
38 ms |
15172 KB |
Output is correct |
50 |
Correct |
43 ms |
15432 KB |
Output is correct |
51 |
Correct |
38 ms |
14468 KB |
Output is correct |
52 |
Correct |
35 ms |
14484 KB |
Output is correct |
53 |
Correct |
38 ms |
14420 KB |
Output is correct |
54 |
Correct |
38 ms |
14440 KB |
Output is correct |
55 |
Correct |
38 ms |
14636 KB |
Output is correct |
56 |
Correct |
40 ms |
14332 KB |
Output is correct |
57 |
Correct |
37 ms |
14320 KB |
Output is correct |
58 |
Correct |
39 ms |
14384 KB |
Output is correct |
59 |
Correct |
40 ms |
14332 KB |
Output is correct |
60 |
Correct |
43 ms |
14332 KB |
Output is correct |