#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
namespace {
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
vector<int> edges;
vector<pi> AdjList[20005];
queue<int> q;
int cnt[12] = {1,0,0,1,0,1,1,0,0,1,0,1};
void genchain(int x, int p, int eweight){
//cerr << x << ' ' << p << ' ' << eweight << '\n';
int c = 0;
for (auto it : AdjList[x]){
if (it.first == p) continue;
c++;
}
if (c >= 2){
if (eweight == 1) cdepth[x] = 1;
else cdepth[x] = 0;
for (auto it : AdjList[x]){
if (it.first == p) continue;
cdepth[it.first] = cdepth[x] + 1;
edges[it.second] = cnt[cdepth[x]%12];
genchain(it.first,x,edges[it.second]);
}
}
else{
for (auto it : AdjList[x]){
if (it.first == p) continue;
cdepth[it.first] = cdepth[x] + 1;
edges[it.second] = cnt[cdepth[x]%12];
genchain(it.first,x,edges[it.second]);
}
}
}
} // namespace
vector<int> Mark(int N, int M, int A, int B,vector<int> U,vector<int> V) {
for (int i = 0; i < N; ++i){
AdjList[i].clear();
cdepth[i] = -1;
}
edges.resize(M,-1);
for (int i = 0; i < M; ++i){
AdjList[U[i]].push_back(pi(V[i],i));
AdjList[V[i]].push_back(pi(U[i],i));
}
cdepth[0] = 0;
genchain(0,-1,0);
for (auto it : edges){
//cerr << it << ' ';
}
//cerr << '\n';
return edges;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
namespace {
int stage = 0;
int cnt[12] = {1,0,0,1,0,1,1,0,0,1,0,1};
int br[12][5];
vector<int> last;
} // namespace
void Init(int A, int B) {
last.clear();
stage = 0;
for (int i = 0; i < 12; ++i){
for (int j = 0; j < 5; ++j){
br[i][j] = cnt[(i+j)%12];
}
}
}
int Move(std::vector<int> y) {
/*
cerr << stage << '\n';
for (auto it : last){
cerr << it << ' ';
}
cerr << '\n';
*/
int mv = -1;
if (stage == 0){
if (y[0] + y[1] == 1){
stage = 2;
if (y[0]){
last.push_back(0);
return 0;
}
else{
last.push_back(1);
return 1;
}
}
else if (y[0] + y[1] > 2){
stage = 2;
if (y[0] == 1) mv = 0;
else mv = 1;
last.push_back(mv);
return mv;
}
stage = 1;
if (y[0] == 2){
last.push_back(0);
last.push_back(0);
return 0;
}
else if (y[1] == 2){
last.push_back(1);
last.push_back(1);
return 1;
}
else{
if (y[0] != 0) mv = 0;
else mv = 1;
last.push_back(1-mv);
last.push_back(mv);
return mv;
}
}
else if (stage == 1){
if (y[0] + y[1] == 1){
if (last.size() >= 4){
int checkers[12];
for (int i = 0; i < 12; ++i) checkers[i] = 1;
last.push_back((y[0] == 1 ? 0 : 1));
for (int i = 0; i < 5; ++i){
for (int j = 0; j < 12; ++j){
if (last[i] != br[j][i]) checkers[j] = 0;
}
}
last.pop_back();
for (int i = 0; i < 12; ++i){
if (checkers[i]){
stage = 2;
last.push_back(last.back());
return -1;
}
}
}
}
if (y[0] == 0 && y[1] == 0){
stage = 2;
last.push_back(last.back());
return -1;
}
else if (y[0] + y[1] == 1){
if (y[0] == 1) mv = 0;
else mv = 1;
last.push_back(mv);
return mv;
}
else{
stage = 2;
if (y[0] == 0){
last.push_back(last.back());
return -1;
}
else if (y[1] == 0){
last.push_back(last.back());
return -1;
}
else{
int x = last.back();
last.push_back(1-x);
return 1-x;
}
}
}
else{
if (y[0] + y[1] == 1){
if (y[1] == 1){
last.push_back(1);
return 1;
}
if (y[0] == 1){
last.push_back(0);
return 0;
}
}
else{
int x = last.back();
last.push_back(1-x);
return 1-x;
}
}
}
Compilation message
Anthony.cpp: In function 'std::vector<int> Mark(int, int, int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:57:12: warning: unused variable 'it' [-Wunused-variable]
for (auto it : edges){
^~
Anthony.cpp: At global scope:
Anthony.cpp:10:54: warning: '{anonymous}::rev' defined but not used [-Wunused-variable]
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
^~~
Anthony.cpp:10:29: warning: '{anonymous}::w' defined but not used [-Wunused-variable]
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
^
Anthony.cpp:10:18: warning: '{anonymous}::hv' defined but not used [-Wunused-variable]
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
^~
Anthony.cpp:10:6: warning: '{anonymous}::sub' defined but not used [-Wunused-variable]
int sub[20005], hv[20005], w[20005], cdepth[20005], rev;
^~~
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:144:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
79 ms |
16588 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
79 ms |
16588 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
14164 KB |
Output is correct |
2 |
Correct |
11 ms |
1536 KB |
Output is correct |
3 |
Correct |
55 ms |
12896 KB |
Output is correct |
4 |
Correct |
72 ms |
15648 KB |
Output is correct |
5 |
Incorrect |
118 ms |
15404 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
14164 KB |
Output is correct |
2 |
Correct |
11 ms |
1536 KB |
Output is correct |
3 |
Correct |
55 ms |
12896 KB |
Output is correct |
4 |
Correct |
72 ms |
15648 KB |
Output is correct |
5 |
Incorrect |
118 ms |
15404 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
1792 KB |
Output is correct |
2 |
Correct |
10 ms |
1536 KB |
Output is correct |
3 |
Correct |
11 ms |
1792 KB |
Output is correct |
4 |
Correct |
10 ms |
1792 KB |
Output is correct |
5 |
Correct |
11 ms |
1792 KB |
Output is correct |
6 |
Correct |
11 ms |
1792 KB |
Output is correct |
7 |
Correct |
11 ms |
1752 KB |
Output is correct |
8 |
Correct |
10 ms |
1792 KB |
Output is correct |
9 |
Correct |
10 ms |
1792 KB |
Output is correct |
10 |
Correct |
10 ms |
1792 KB |
Output is correct |
11 |
Correct |
10 ms |
1792 KB |
Output is correct |
12 |
Correct |
11 ms |
1792 KB |
Output is correct |
13 |
Correct |
11 ms |
1792 KB |
Output is correct |
14 |
Correct |
10 ms |
1792 KB |
Output is correct |
15 |
Correct |
11 ms |
1744 KB |
Output is correct |
16 |
Correct |
12 ms |
1816 KB |
Output is correct |
17 |
Correct |
11 ms |
1632 KB |
Output is correct |
18 |
Correct |
11 ms |
1536 KB |
Output is correct |
19 |
Correct |
10 ms |
1536 KB |
Output is correct |
20 |
Correct |
11 ms |
1792 KB |
Output is correct |
21 |
Correct |
10 ms |
1688 KB |
Output is correct |
22 |
Correct |
11 ms |
1792 KB |
Output is correct |
23 |
Correct |
10 ms |
1792 KB |
Output is correct |
24 |
Correct |
11 ms |
1792 KB |
Output is correct |
25 |
Correct |
10 ms |
1688 KB |
Output is correct |
26 |
Correct |
11 ms |
1792 KB |
Output is correct |
27 |
Correct |
12 ms |
1548 KB |
Output is correct |
28 |
Correct |
10 ms |
1536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
11628 KB |
Output is correct |
2 |
Correct |
80 ms |
12612 KB |
Output is correct |
3 |
Correct |
10 ms |
1536 KB |
Output is correct |
4 |
Correct |
47 ms |
11248 KB |
Output is correct |
5 |
Correct |
70 ms |
13948 KB |
Output is correct |
6 |
Correct |
75 ms |
13804 KB |
Output is correct |
7 |
Correct |
56 ms |
13012 KB |
Output is correct |
8 |
Correct |
53 ms |
13052 KB |
Output is correct |
9 |
Correct |
65 ms |
14412 KB |
Output is correct |
10 |
Correct |
66 ms |
14284 KB |
Output is correct |
11 |
Correct |
74 ms |
13828 KB |
Output is correct |
12 |
Correct |
89 ms |
13900 KB |
Output is correct |
13 |
Correct |
67 ms |
14288 KB |
Output is correct |
14 |
Correct |
104 ms |
14180 KB |
Output is correct |
15 |
Correct |
78 ms |
14540 KB |
Output is correct |
16 |
Correct |
71 ms |
13812 KB |
Output is correct |
17 |
Correct |
72 ms |
13564 KB |
Output is correct |
18 |
Correct |
66 ms |
14028 KB |
Output is correct |
19 |
Correct |
66 ms |
14044 KB |
Output is correct |
20 |
Correct |
72 ms |
13564 KB |
Output is correct |
21 |
Correct |
84 ms |
13476 KB |
Output is correct |
22 |
Correct |
69 ms |
14044 KB |
Output is correct |
23 |
Correct |
77 ms |
11936 KB |
Output is correct |
24 |
Correct |
57 ms |
11852 KB |
Output is correct |
25 |
Correct |
64 ms |
12224 KB |
Output is correct |
26 |
Correct |
59 ms |
12252 KB |
Output is correct |
27 |
Correct |
72 ms |
13004 KB |
Output is correct |
28 |
Correct |
63 ms |
12660 KB |
Output is correct |
29 |
Correct |
69 ms |
12944 KB |
Output is correct |
30 |
Correct |
62 ms |
13140 KB |
Output is correct |
31 |
Correct |
53 ms |
11492 KB |
Output is correct |
32 |
Correct |
63 ms |
11980 KB |
Output is correct |
33 |
Correct |
57 ms |
12312 KB |
Output is correct |
34 |
Correct |
63 ms |
12348 KB |
Output is correct |
35 |
Correct |
57 ms |
12788 KB |
Output is correct |
36 |
Correct |
59 ms |
12668 KB |
Output is correct |
37 |
Correct |
75 ms |
12956 KB |
Output is correct |
38 |
Correct |
60 ms |
12796 KB |
Output is correct |
39 |
Correct |
56 ms |
12784 KB |
Output is correct |
40 |
Correct |
70 ms |
13004 KB |
Output is correct |
41 |
Correct |
64 ms |
13516 KB |
Output is correct |
42 |
Correct |
62 ms |
13580 KB |
Output is correct |
43 |
Correct |
79 ms |
13516 KB |
Output is correct |
44 |
Correct |
64 ms |
13516 KB |
Output is correct |
45 |
Correct |
64 ms |
13044 KB |
Output is correct |
46 |
Correct |
66 ms |
13436 KB |
Output is correct |
47 |
Correct |
68 ms |
12884 KB |
Output is correct |
48 |
Correct |
59 ms |
12876 KB |
Output is correct |
49 |
Correct |
57 ms |
12712 KB |
Output is correct |
50 |
Correct |
55 ms |
12452 KB |
Output is correct |
51 |
Correct |
54 ms |
12108 KB |
Output is correct |
52 |
Correct |
52 ms |
11580 KB |
Output is correct |
53 |
Correct |
53 ms |
11760 KB |
Output is correct |
54 |
Correct |
66 ms |
11760 KB |
Output is correct |
55 |
Correct |
68 ms |
11728 KB |
Output is correct |
56 |
Correct |
79 ms |
11792 KB |
Output is correct |
57 |
Correct |
57 ms |
11604 KB |
Output is correct |
58 |
Correct |
74 ms |
11644 KB |
Output is correct |
59 |
Correct |
71 ms |
11644 KB |
Output is correct |
60 |
Correct |
70 ms |
11652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
11388 KB |
Output is correct |
2 |
Correct |
64 ms |
12428 KB |
Output is correct |
3 |
Correct |
10 ms |
1536 KB |
Output is correct |
4 |
Correct |
49 ms |
11456 KB |
Output is correct |
5 |
Correct |
69 ms |
13820 KB |
Output is correct |
6 |
Correct |
74 ms |
14028 KB |
Output is correct |
7 |
Correct |
52 ms |
13052 KB |
Output is correct |
8 |
Correct |
74 ms |
13504 KB |
Output is correct |
9 |
Correct |
66 ms |
13996 KB |
Output is correct |
10 |
Correct |
71 ms |
13948 KB |
Output is correct |
11 |
Correct |
89 ms |
13940 KB |
Output is correct |
12 |
Correct |
66 ms |
13812 KB |
Output is correct |
13 |
Correct |
75 ms |
14236 KB |
Output is correct |
14 |
Correct |
74 ms |
14032 KB |
Output is correct |
15 |
Correct |
72 ms |
13812 KB |
Output is correct |
16 |
Correct |
67 ms |
14420 KB |
Output is correct |
17 |
Correct |
69 ms |
13548 KB |
Output is correct |
18 |
Correct |
65 ms |
14120 KB |
Output is correct |
19 |
Correct |
69 ms |
13936 KB |
Output is correct |
20 |
Correct |
83 ms |
13548 KB |
Output is correct |
21 |
Correct |
65 ms |
13504 KB |
Output is correct |
22 |
Correct |
65 ms |
14048 KB |
Output is correct |
23 |
Correct |
54 ms |
11548 KB |
Output is correct |
24 |
Correct |
52 ms |
11928 KB |
Output is correct |
25 |
Correct |
52 ms |
11772 KB |
Output is correct |
26 |
Correct |
55 ms |
12360 KB |
Output is correct |
27 |
Correct |
56 ms |
13012 KB |
Output is correct |
28 |
Correct |
64 ms |
12676 KB |
Output is correct |
29 |
Correct |
64 ms |
12776 KB |
Output is correct |
30 |
Correct |
60 ms |
13164 KB |
Output is correct |
31 |
Correct |
54 ms |
11408 KB |
Output is correct |
32 |
Correct |
54 ms |
11380 KB |
Output is correct |
33 |
Correct |
53 ms |
11892 KB |
Output is correct |
34 |
Correct |
54 ms |
12372 KB |
Output is correct |
35 |
Correct |
59 ms |
13004 KB |
Output is correct |
36 |
Correct |
64 ms |
12964 KB |
Output is correct |
37 |
Correct |
59 ms |
13012 KB |
Output is correct |
38 |
Correct |
59 ms |
12544 KB |
Output is correct |
39 |
Correct |
66 ms |
12492 KB |
Output is correct |
40 |
Correct |
61 ms |
12536 KB |
Output is correct |
41 |
Correct |
62 ms |
13620 KB |
Output is correct |
42 |
Correct |
64 ms |
13640 KB |
Output is correct |
43 |
Correct |
64 ms |
13524 KB |
Output is correct |
44 |
Correct |
67 ms |
13600 KB |
Output is correct |
45 |
Correct |
64 ms |
13644 KB |
Output is correct |
46 |
Correct |
72 ms |
13524 KB |
Output is correct |
47 |
Correct |
59 ms |
12836 KB |
Output is correct |
48 |
Correct |
59 ms |
12640 KB |
Output is correct |
49 |
Correct |
64 ms |
12748 KB |
Output is correct |
50 |
Correct |
64 ms |
12748 KB |
Output is correct |
51 |
Correct |
56 ms |
12200 KB |
Output is correct |
52 |
Correct |
65 ms |
12236 KB |
Output is correct |
53 |
Correct |
51 ms |
12216 KB |
Output is correct |
54 |
Correct |
54 ms |
12220 KB |
Output is correct |
55 |
Correct |
54 ms |
12108 KB |
Output is correct |
56 |
Correct |
55 ms |
12228 KB |
Output is correct |
57 |
Correct |
67 ms |
12080 KB |
Output is correct |
58 |
Correct |
62 ms |
12108 KB |
Output is correct |
59 |
Correct |
60 ms |
12076 KB |
Output is correct |
60 |
Correct |
52 ms |
11876 KB |
Output is correct |