#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
const int NMAX = 2e4 + 5;
const int ROOT = 0;
vector < int > G[NMAX];
vector < int > ans;
int Level[NMAX];
bool Sel[NMAX];
queue < int > Q;
void Add_Edge (int x, int y)
{
G[x].push_back(y), G[y].push_back(x);
return;
}
void BFS (int Node)
{
Sel[Node] = 1, Level[Node] = 0;
Q.push(Node);
while(!Q.empty())
{
int Node = Q.front();
Q.pop();
for(auto it : G[Node])
if(!Sel[it])
{
Sel[it] = 1, Level[it] = 1 + Level[Node];
Q.push(it);
}
}
return;
}
vector < int > Mark (int N, int M, int A, int B, vector < int > U, vector < int > V)
{
for(int i = 0; i < M; ++i)
{
int X = U[i], Y = V[i];
Add_Edge(X, Y);
}
BFS(ROOT);
ans.resize(M);
ans.shrink_to_fit();
if(A >= 3)
A = 3;
for(int i = 0; i < M; ++i)
ans[i] = min(Level[U[i]], Level[V[i]]) % A;
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
int A, B, moves = 0, Last = 0;
void Init (int a, int b)
{
A = a, B = b;
return;
}
int Move (vector < int > y)
{
++moves;
int cnt = 0, X = -1;
for(int i = 0; i < A; ++i)
if(y[i])
++cnt, X = i;
if(cnt == 0)
return -1;
if(cnt == 1 || (A == 2 && moves == 1))
{
Last = X;
return X;
}
if(A == 2)
{
for(int i = 0; i < A; ++i)
if(y[i] && i != Last)
{
Last = i;
break;
}
return Last;
}
if(y[0] && y[1])
return 0;
if(y[1] && y[2])
return 1;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
15616 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
39 ms |
15220 KB |
Output is correct |
4 |
Correct |
57 ms |
16836 KB |
Output is correct |
5 |
Correct |
56 ms |
16776 KB |
Output is correct |
6 |
Correct |
45 ms |
15580 KB |
Output is correct |
7 |
Correct |
48 ms |
15648 KB |
Output is correct |
8 |
Correct |
52 ms |
16108 KB |
Output is correct |
9 |
Correct |
52 ms |
16124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
15616 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
39 ms |
15220 KB |
Output is correct |
4 |
Correct |
57 ms |
16836 KB |
Output is correct |
5 |
Correct |
56 ms |
16776 KB |
Output is correct |
6 |
Correct |
45 ms |
15580 KB |
Output is correct |
7 |
Correct |
48 ms |
15648 KB |
Output is correct |
8 |
Correct |
52 ms |
16108 KB |
Output is correct |
9 |
Correct |
52 ms |
16124 KB |
Output is correct |
10 |
Correct |
43 ms |
13636 KB |
Output is correct |
11 |
Correct |
41 ms |
13632 KB |
Output is correct |
12 |
Correct |
43 ms |
13648 KB |
Output is correct |
13 |
Correct |
43 ms |
13560 KB |
Output is correct |
14 |
Correct |
44 ms |
13940 KB |
Output is correct |
15 |
Correct |
48 ms |
14064 KB |
Output is correct |
16 |
Correct |
70 ms |
16380 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
13176 KB |
Output is correct |
2 |
Correct |
2 ms |
1536 KB |
Output is correct |
3 |
Correct |
52 ms |
12664 KB |
Output is correct |
4 |
Correct |
78 ms |
14700 KB |
Output is correct |
5 |
Correct |
83 ms |
14884 KB |
Output is correct |
6 |
Correct |
47 ms |
13436 KB |
Output is correct |
7 |
Correct |
44 ms |
13660 KB |
Output is correct |
8 |
Correct |
53 ms |
14196 KB |
Output is correct |
9 |
Correct |
53 ms |
14144 KB |
Output is correct |
10 |
Correct |
50 ms |
13864 KB |
Output is correct |
11 |
Correct |
50 ms |
13960 KB |
Output is correct |
12 |
Correct |
54 ms |
13924 KB |
Output is correct |
13 |
Correct |
61 ms |
13820 KB |
Output is correct |
14 |
Correct |
58 ms |
14212 KB |
Output is correct |
15 |
Correct |
51 ms |
14172 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
13176 KB |
Output is correct |
2 |
Correct |
2 ms |
1536 KB |
Output is correct |
3 |
Correct |
52 ms |
12664 KB |
Output is correct |
4 |
Correct |
78 ms |
14700 KB |
Output is correct |
5 |
Correct |
83 ms |
14884 KB |
Output is correct |
6 |
Correct |
47 ms |
13436 KB |
Output is correct |
7 |
Correct |
44 ms |
13660 KB |
Output is correct |
8 |
Correct |
53 ms |
14196 KB |
Output is correct |
9 |
Correct |
53 ms |
14144 KB |
Output is correct |
10 |
Correct |
50 ms |
13864 KB |
Output is correct |
11 |
Correct |
50 ms |
13960 KB |
Output is correct |
12 |
Correct |
54 ms |
13924 KB |
Output is correct |
13 |
Correct |
61 ms |
13820 KB |
Output is correct |
14 |
Correct |
58 ms |
14212 KB |
Output is correct |
15 |
Correct |
51 ms |
14172 KB |
Output is correct |
16 |
Correct |
48 ms |
12036 KB |
Output is correct |
17 |
Correct |
63 ms |
11916 KB |
Output is correct |
18 |
Correct |
41 ms |
11984 KB |
Output is correct |
19 |
Correct |
43 ms |
12024 KB |
Output is correct |
20 |
Correct |
46 ms |
12644 KB |
Output is correct |
21 |
Correct |
46 ms |
12280 KB |
Output is correct |
22 |
Correct |
51 ms |
14340 KB |
Output is correct |
23 |
Correct |
52 ms |
12120 KB |
Output is correct |
24 |
Correct |
41 ms |
12116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1536 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
2 ms |
1792 KB |
Output is correct |
4 |
Correct |
2 ms |
1552 KB |
Output is correct |
5 |
Correct |
2 ms |
1552 KB |
Output is correct |
6 |
Correct |
2 ms |
1536 KB |
Output is correct |
7 |
Correct |
2 ms |
1536 KB |
Output is correct |
8 |
Correct |
2 ms |
1536 KB |
Output is correct |
9 |
Correct |
2 ms |
1560 KB |
Output is correct |
10 |
Correct |
2 ms |
1536 KB |
Output is correct |
11 |
Correct |
2 ms |
1552 KB |
Output is correct |
12 |
Correct |
2 ms |
1792 KB |
Output is correct |
13 |
Correct |
2 ms |
1536 KB |
Output is correct |
14 |
Correct |
2 ms |
1552 KB |
Output is correct |
15 |
Correct |
2 ms |
1536 KB |
Output is correct |
16 |
Correct |
2 ms |
1792 KB |
Output is correct |
17 |
Correct |
2 ms |
1536 KB |
Output is correct |
18 |
Correct |
2 ms |
1536 KB |
Output is correct |
19 |
Correct |
2 ms |
1792 KB |
Output is correct |
20 |
Correct |
2 ms |
1536 KB |
Output is correct |
21 |
Correct |
2 ms |
1536 KB |
Output is correct |
22 |
Correct |
2 ms |
1536 KB |
Output is correct |
23 |
Correct |
2 ms |
1536 KB |
Output is correct |
24 |
Correct |
2 ms |
1536 KB |
Output is correct |
25 |
Correct |
2 ms |
1536 KB |
Output is correct |
26 |
Correct |
2 ms |
1536 KB |
Output is correct |
27 |
Correct |
2 ms |
1536 KB |
Output is correct |
28 |
Correct |
2 ms |
1536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
11812 KB |
Output is correct |
2 |
Correct |
45 ms |
12432 KB |
Output is correct |
3 |
Correct |
1 ms |
1680 KB |
Output is correct |
4 |
Correct |
35 ms |
11560 KB |
Output is correct |
5 |
Correct |
57 ms |
13396 KB |
Output is correct |
6 |
Correct |
53 ms |
13600 KB |
Output is correct |
7 |
Incorrect |
40 ms |
12500 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
11888 KB |
Output is correct |
2 |
Correct |
45 ms |
12284 KB |
Output is correct |
3 |
Correct |
1 ms |
1536 KB |
Output is correct |
4 |
Correct |
43 ms |
11572 KB |
Output is correct |
5 |
Correct |
75 ms |
13572 KB |
Output is correct |
6 |
Correct |
51 ms |
13580 KB |
Output is correct |
7 |
Incorrect |
39 ms |
12500 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |