#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>
#define maxn 20005
#define pii pair<int, int>
using namespace std;
namespace {
vector<pii> adj[maxn];
int res[maxn];
int arr[6] = {0, 0, 1, 0, 1, 1};
const int inf = 8e7;
void dfs(int n, int par, int ind, int prv) {
int deg = adj[n].size() - (par == -1 ? 0 : 1);
if (deg == 1) {
for (auto [v, id]:adj[n]) {
if (v != par) {
res[id] = arr[ind];
dfs(v, n, (ind+1)%6, res[id]);
}
}
} else {
for (auto [v, id]:adj[n]) {
if (v != par) {
res[id] = prv ^ 1;
dfs(v, n, res[id] ? 5 : 1, res[id]);
}
}
}
}
};
vector<int> Mark(int N, int M, int A, int B,
vector<int> U, vector<int> V) {
for (int i = 0;i < M;i++) adj[U[i]].push_back({V[i], i}), adj[V[i]].push_back({U[i], i});
vector<int> X(M);
dfs(0, -1, 0, 0);
for (int i = 0;i < M;i++) X[i] = res[i];
return X;
}
#include "Catherine.h"
#include <vector>
#include "assert.h"
using namespace std;
namespace {
int A, B;
bool type = 0;
int prv = 0, step = 0, mask = 0;
int check[6] = {12, 25, 18, 5, 11, 22};
};
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(vector<int> y) {
int sum = y[0] + y[1];
sum += (step ? 1 : 0);
if (sum > 2) {
step++;
if (y[0] == 0 || y[1] == 0) {
return -1;
}
if (step > 1) y[prv]++;
prv = y[0] == 1 ? 0 : 1;
return prv;
} else {
if (step) sum--;
step++;
if (sum == 1) {
if (type && step == 4) {
mask = mask * 2 + (y[0] == 1 ? 0 : 1);
bool match = 0;
for (int i = 0;i < 6;i++) {
if (mask == check[i]) match = 1;
}
if (match) return -1;
}
prv = y[0] == 1 ? 0 : 1;
if (step < 4) mask = mask * 2 + prv;
return prv;
} else {
if (sum == 0) return -1;
prv = y[0] ? 0 : 1;
y[prv]--;
type = 1;
mask = (y[0] ? 0 : 1) * 2 + prv;
return prv;
}
}
}
/*
11 10 2 6 6
0 2
0 3
0 4
3 5
5 7
5 8
7 10
4 6
6 9
9 1
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
15704 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
33 ms |
15704 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
13220 KB |
Output is correct |
2 |
Correct |
1 ms |
1008 KB |
Output is correct |
3 |
Correct |
26 ms |
12648 KB |
Output is correct |
4 |
Correct |
49 ms |
15052 KB |
Output is correct |
5 |
Incorrect |
37 ms |
14940 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
39 ms |
13220 KB |
Output is correct |
2 |
Correct |
1 ms |
1008 KB |
Output is correct |
3 |
Correct |
26 ms |
12648 KB |
Output is correct |
4 |
Correct |
49 ms |
15052 KB |
Output is correct |
5 |
Incorrect |
37 ms |
14940 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1256 KB |
Output is correct |
2 |
Correct |
1 ms |
1000 KB |
Output is correct |
3 |
Correct |
2 ms |
1260 KB |
Output is correct |
4 |
Correct |
2 ms |
1260 KB |
Output is correct |
5 |
Correct |
2 ms |
1332 KB |
Output is correct |
6 |
Correct |
2 ms |
1260 KB |
Output is correct |
7 |
Correct |
2 ms |
1264 KB |
Output is correct |
8 |
Correct |
2 ms |
1260 KB |
Output is correct |
9 |
Correct |
2 ms |
1372 KB |
Output is correct |
10 |
Correct |
2 ms |
1268 KB |
Output is correct |
11 |
Correct |
2 ms |
1260 KB |
Output is correct |
12 |
Correct |
1 ms |
1268 KB |
Output is correct |
13 |
Correct |
1 ms |
1268 KB |
Output is correct |
14 |
Correct |
2 ms |
1256 KB |
Output is correct |
15 |
Correct |
2 ms |
1260 KB |
Output is correct |
16 |
Correct |
1 ms |
1260 KB |
Output is correct |
17 |
Correct |
2 ms |
1260 KB |
Output is correct |
18 |
Correct |
2 ms |
1268 KB |
Output is correct |
19 |
Correct |
2 ms |
1260 KB |
Output is correct |
20 |
Correct |
2 ms |
1264 KB |
Output is correct |
21 |
Correct |
2 ms |
1260 KB |
Output is correct |
22 |
Correct |
2 ms |
1268 KB |
Output is correct |
23 |
Correct |
2 ms |
1268 KB |
Output is correct |
24 |
Correct |
2 ms |
1260 KB |
Output is correct |
25 |
Correct |
2 ms |
1268 KB |
Output is correct |
26 |
Correct |
2 ms |
1260 KB |
Output is correct |
27 |
Correct |
1 ms |
1260 KB |
Output is correct |
28 |
Correct |
2 ms |
1268 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
10976 KB |
Output is correct |
2 |
Correct |
37 ms |
12096 KB |
Output is correct |
3 |
Correct |
1 ms |
1008 KB |
Output is correct |
4 |
Correct |
28 ms |
11032 KB |
Output is correct |
5 |
Correct |
52 ms |
13452 KB |
Output is correct |
6 |
Correct |
45 ms |
13476 KB |
Output is correct |
7 |
Correct |
32 ms |
12560 KB |
Output is correct |
8 |
Correct |
32 ms |
12584 KB |
Output is correct |
9 |
Correct |
38 ms |
13456 KB |
Output is correct |
10 |
Correct |
39 ms |
13400 KB |
Output is correct |
11 |
Correct |
40 ms |
13592 KB |
Output is correct |
12 |
Correct |
37 ms |
13520 KB |
Output is correct |
13 |
Correct |
39 ms |
13492 KB |
Output is correct |
14 |
Correct |
44 ms |
13448 KB |
Output is correct |
15 |
Correct |
38 ms |
13472 KB |
Output is correct |
16 |
Correct |
38 ms |
13568 KB |
Output is correct |
17 |
Correct |
34 ms |
13204 KB |
Output is correct |
18 |
Correct |
35 ms |
13296 KB |
Output is correct |
19 |
Correct |
35 ms |
13252 KB |
Output is correct |
20 |
Correct |
42 ms |
13112 KB |
Output is correct |
21 |
Correct |
38 ms |
13208 KB |
Output is correct |
22 |
Correct |
35 ms |
13164 KB |
Output is correct |
23 |
Correct |
32 ms |
11040 KB |
Output is correct |
24 |
Correct |
31 ms |
10884 KB |
Output is correct |
25 |
Correct |
35 ms |
11368 KB |
Output is correct |
26 |
Correct |
36 ms |
11432 KB |
Output is correct |
27 |
Correct |
34 ms |
12256 KB |
Output is correct |
28 |
Correct |
34 ms |
12188 KB |
Output is correct |
29 |
Correct |
41 ms |
12072 KB |
Output is correct |
30 |
Correct |
35 ms |
12204 KB |
Output is correct |
31 |
Correct |
28 ms |
11016 KB |
Output is correct |
32 |
Correct |
28 ms |
10956 KB |
Output is correct |
33 |
Correct |
31 ms |
11440 KB |
Output is correct |
34 |
Correct |
36 ms |
11280 KB |
Output is correct |
35 |
Correct |
35 ms |
11928 KB |
Output is correct |
36 |
Correct |
33 ms |
11980 KB |
Output is correct |
37 |
Correct |
34 ms |
12040 KB |
Output is correct |
38 |
Correct |
33 ms |
11996 KB |
Output is correct |
39 |
Correct |
33 ms |
12008 KB |
Output is correct |
40 |
Correct |
34 ms |
12024 KB |
Output is correct |
41 |
Correct |
35 ms |
12760 KB |
Output is correct |
42 |
Correct |
34 ms |
12752 KB |
Output is correct |
43 |
Correct |
41 ms |
12588 KB |
Output is correct |
44 |
Correct |
39 ms |
12632 KB |
Output is correct |
45 |
Correct |
43 ms |
12780 KB |
Output is correct |
46 |
Correct |
39 ms |
12708 KB |
Output is correct |
47 |
Correct |
32 ms |
11872 KB |
Output is correct |
48 |
Correct |
33 ms |
11808 KB |
Output is correct |
49 |
Correct |
32 ms |
11832 KB |
Output is correct |
50 |
Correct |
34 ms |
11912 KB |
Output is correct |
51 |
Correct |
31 ms |
10944 KB |
Output is correct |
52 |
Correct |
35 ms |
10992 KB |
Output is correct |
53 |
Correct |
30 ms |
10956 KB |
Output is correct |
54 |
Correct |
33 ms |
10924 KB |
Output is correct |
55 |
Correct |
28 ms |
10992 KB |
Output is correct |
56 |
Correct |
31 ms |
10996 KB |
Output is correct |
57 |
Correct |
31 ms |
11164 KB |
Output is correct |
58 |
Correct |
31 ms |
11216 KB |
Output is correct |
59 |
Correct |
33 ms |
11284 KB |
Output is correct |
60 |
Correct |
31 ms |
11236 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
10952 KB |
Output is correct |
2 |
Correct |
33 ms |
12032 KB |
Output is correct |
3 |
Correct |
0 ms |
1012 KB |
Output is correct |
4 |
Correct |
26 ms |
10960 KB |
Output is correct |
5 |
Correct |
38 ms |
13520 KB |
Output is correct |
6 |
Correct |
38 ms |
13576 KB |
Output is correct |
7 |
Correct |
32 ms |
12684 KB |
Output is correct |
8 |
Correct |
32 ms |
13084 KB |
Output is correct |
9 |
Correct |
40 ms |
13832 KB |
Output is correct |
10 |
Correct |
45 ms |
13992 KB |
Output is correct |
11 |
Correct |
38 ms |
13924 KB |
Output is correct |
12 |
Correct |
43 ms |
14024 KB |
Output is correct |
13 |
Correct |
39 ms |
13924 KB |
Output is correct |
14 |
Correct |
38 ms |
13928 KB |
Output is correct |
15 |
Correct |
38 ms |
13960 KB |
Output is correct |
16 |
Correct |
56 ms |
13904 KB |
Output is correct |
17 |
Correct |
39 ms |
13592 KB |
Output is correct |
18 |
Correct |
35 ms |
13716 KB |
Output is correct |
19 |
Correct |
37 ms |
13556 KB |
Output is correct |
20 |
Correct |
46 ms |
13604 KB |
Output is correct |
21 |
Correct |
48 ms |
13608 KB |
Output is correct |
22 |
Correct |
36 ms |
13696 KB |
Output is correct |
23 |
Correct |
28 ms |
11448 KB |
Output is correct |
24 |
Correct |
30 ms |
11348 KB |
Output is correct |
25 |
Correct |
32 ms |
11884 KB |
Output is correct |
26 |
Correct |
38 ms |
11868 KB |
Output is correct |
27 |
Correct |
37 ms |
12632 KB |
Output is correct |
28 |
Correct |
37 ms |
12556 KB |
Output is correct |
29 |
Correct |
36 ms |
12680 KB |
Output is correct |
30 |
Correct |
35 ms |
12576 KB |
Output is correct |
31 |
Correct |
32 ms |
11420 KB |
Output is correct |
32 |
Correct |
45 ms |
11280 KB |
Output is correct |
33 |
Correct |
33 ms |
11820 KB |
Output is correct |
34 |
Correct |
31 ms |
11772 KB |
Output is correct |
35 |
Correct |
33 ms |
12456 KB |
Output is correct |
36 |
Correct |
34 ms |
12464 KB |
Output is correct |
37 |
Correct |
33 ms |
12444 KB |
Output is correct |
38 |
Correct |
39 ms |
12484 KB |
Output is correct |
39 |
Correct |
39 ms |
12436 KB |
Output is correct |
40 |
Correct |
34 ms |
12464 KB |
Output is correct |
41 |
Correct |
36 ms |
13088 KB |
Output is correct |
42 |
Correct |
36 ms |
13012 KB |
Output is correct |
43 |
Correct |
36 ms |
13120 KB |
Output is correct |
44 |
Correct |
41 ms |
13000 KB |
Output is correct |
45 |
Correct |
41 ms |
12972 KB |
Output is correct |
46 |
Correct |
37 ms |
13072 KB |
Output is correct |
47 |
Correct |
32 ms |
12172 KB |
Output is correct |
48 |
Correct |
32 ms |
12396 KB |
Output is correct |
49 |
Correct |
33 ms |
12136 KB |
Output is correct |
50 |
Correct |
33 ms |
12308 KB |
Output is correct |
51 |
Correct |
30 ms |
11280 KB |
Output is correct |
52 |
Correct |
30 ms |
11360 KB |
Output is correct |
53 |
Correct |
36 ms |
11404 KB |
Output is correct |
54 |
Correct |
35 ms |
11292 KB |
Output is correct |
55 |
Correct |
31 ms |
11380 KB |
Output is correct |
56 |
Correct |
32 ms |
11272 KB |
Output is correct |
57 |
Correct |
39 ms |
11560 KB |
Output is correct |
58 |
Correct |
34 ms |
11528 KB |
Output is correct |
59 |
Correct |
30 ms |
11736 KB |
Output is correct |
60 |
Correct |
34 ms |
11880 KB |
Output is correct |