#include <bits/stdc++.h>
#include "incursion.h"
using namespace std;
vector<int> mark(vector<pair<int, int>> F, int safe) {
int n = (int) F.size() + 1;
vector<vector<int>> g(n);
for (int i = 0; i < n - 1; ++i) {
auto [u, v] = F[i];
--u, --v;
g[u].push_back(v);
g[v].push_back(u);
}
vector<int> ties(n);
function<void(int, int, int)> dfs = [&](int v, int p, int cur) {
ties[v] = cur;
int nxt = (cur - 1 + 3) % 3;
for (int u : g[v]) {
if (u != p) {
dfs(u, v, nxt);
}
}
};
dfs(safe - 1, safe - 1, 0);
return ties;
}
void locate(vector<pair<int, int>> F, int curr, int t) {
int n = (int) F.size() + 1;
vector<vector<int>> g(n);
for (int i = 0; i < n - 1; ++i) {
auto [u, v] = F[i];
--u, --v;
g[u].push_back(v);
g[v].push_back(u);
}
function<void(int, int, int)> dfs = [&](int v, int p, int t) {
for (int u : g[v]) {
if (u == p) {
continue;
}
int new_val = visit(u + 1);
if (new_val == (t + 1) % 3) {
return dfs(u, v, new_val);
}
visit(v + 1);
}
};
dfs(curr - 1, curr - 1, t);
}
Compilation message
interface.cpp: In function 'int main()':
interface.cpp:44:55: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
44 | if(fread(T.data(), sizeof(int), 2 * N - 2, stdin) != 2 * N - 2) exit(0);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
interface.cpp:50:33: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
50 | int l = (numbers.size() == N ? N : 0);
| ~~~~~~~~~~~~~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
768 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
185 ms |
14540 KB |
Partially correct |
2 |
Partially correct |
213 ms |
14380 KB |
Partially correct |
3 |
Partially correct |
107 ms |
12560 KB |
Partially correct |
4 |
Partially correct |
92 ms |
10904 KB |
Partially correct |
5 |
Partially correct |
193 ms |
13680 KB |
Partially correct |
6 |
Partially correct |
78 ms |
9840 KB |
Partially correct |
7 |
Partially correct |
76 ms |
9576 KB |
Partially correct |
8 |
Partially correct |
210 ms |
14392 KB |
Partially correct |
9 |
Partially correct |
207 ms |
14748 KB |
Partially correct |
10 |
Partially correct |
162 ms |
12308 KB |
Partially correct |
11 |
Partially correct |
89 ms |
11612 KB |
Partially correct |
12 |
Partially correct |
263 ms |
15068 KB |
Partially correct |
13 |
Partially correct |
78 ms |
9628 KB |
Partially correct |
14 |
Partially correct |
78 ms |
9820 KB |
Partially correct |
15 |
Partially correct |
225 ms |
14748 KB |
Partially correct |
16 |
Partially correct |
216 ms |
15012 KB |
Partially correct |
17 |
Partially correct |
113 ms |
12216 KB |
Partially correct |
18 |
Partially correct |
84 ms |
11424 KB |
Partially correct |
19 |
Partially correct |
154 ms |
12072 KB |
Partially correct |
20 |
Partially correct |
71 ms |
9572 KB |
Partially correct |
21 |
Partially correct |
79 ms |
9884 KB |
Partially correct |
22 |
Partially correct |
216 ms |
14760 KB |
Partially correct |
23 |
Partially correct |
209 ms |
14500 KB |
Partially correct |
24 |
Partially correct |
95 ms |
10912 KB |
Partially correct |
25 |
Partially correct |
83 ms |
12424 KB |
Partially correct |
26 |
Partially correct |
90 ms |
10832 KB |
Partially correct |
27 |
Partially correct |
74 ms |
9888 KB |
Partially correct |
28 |
Partially correct |
70 ms |
9628 KB |
Partially correct |
29 |
Partially correct |
193 ms |
14748 KB |
Partially correct |
30 |
Partially correct |
224 ms |
14332 KB |
Partially correct |
31 |
Partially correct |
86 ms |
10076 KB |
Partially correct |
32 |
Partially correct |
260 ms |
14408 KB |
Partially correct |
33 |
Partially correct |
243 ms |
14320 KB |
Partially correct |
34 |
Partially correct |
84 ms |
9820 KB |
Partially correct |
35 |
Partially correct |
78 ms |
9748 KB |
Partially correct |
36 |
Partially correct |
197 ms |
14604 KB |
Partially correct |
37 |
Partially correct |
214 ms |
14504 KB |
Partially correct |
38 |
Partially correct |
277 ms |
14084 KB |
Partially correct |
39 |
Partially correct |
136 ms |
13212 KB |
Partially correct |
40 |
Partially correct |
213 ms |
13884 KB |
Partially correct |
41 |
Partially correct |
72 ms |
9564 KB |
Partially correct |
42 |
Partially correct |
84 ms |
9756 KB |
Partially correct |
43 |
Partially correct |
213 ms |
14856 KB |
Partially correct |
44 |
Partially correct |
212 ms |
14420 KB |
Partially correct |
45 |
Partially correct |
88 ms |
11164 KB |
Partially correct |
46 |
Partially correct |
82 ms |
11360 KB |
Partially correct |
47 |
Partially correct |
96 ms |
11100 KB |
Partially correct |
48 |
Partially correct |
74 ms |
9424 KB |
Partially correct |
49 |
Partially correct |
78 ms |
9628 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
75 ms |
7256 KB |
Partially correct |
2 |
Incorrect |
76 ms |
7260 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
768 KB |
Partially correct |
2 |
Partially correct |
185 ms |
14540 KB |
Partially correct |
3 |
Partially correct |
213 ms |
14380 KB |
Partially correct |
4 |
Partially correct |
107 ms |
12560 KB |
Partially correct |
5 |
Partially correct |
92 ms |
10904 KB |
Partially correct |
6 |
Partially correct |
193 ms |
13680 KB |
Partially correct |
7 |
Partially correct |
78 ms |
9840 KB |
Partially correct |
8 |
Partially correct |
76 ms |
9576 KB |
Partially correct |
9 |
Partially correct |
210 ms |
14392 KB |
Partially correct |
10 |
Partially correct |
207 ms |
14748 KB |
Partially correct |
11 |
Partially correct |
162 ms |
12308 KB |
Partially correct |
12 |
Partially correct |
89 ms |
11612 KB |
Partially correct |
13 |
Partially correct |
263 ms |
15068 KB |
Partially correct |
14 |
Partially correct |
78 ms |
9628 KB |
Partially correct |
15 |
Partially correct |
78 ms |
9820 KB |
Partially correct |
16 |
Partially correct |
225 ms |
14748 KB |
Partially correct |
17 |
Partially correct |
216 ms |
15012 KB |
Partially correct |
18 |
Partially correct |
113 ms |
12216 KB |
Partially correct |
19 |
Partially correct |
84 ms |
11424 KB |
Partially correct |
20 |
Partially correct |
154 ms |
12072 KB |
Partially correct |
21 |
Partially correct |
71 ms |
9572 KB |
Partially correct |
22 |
Partially correct |
79 ms |
9884 KB |
Partially correct |
23 |
Partially correct |
216 ms |
14760 KB |
Partially correct |
24 |
Partially correct |
209 ms |
14500 KB |
Partially correct |
25 |
Partially correct |
95 ms |
10912 KB |
Partially correct |
26 |
Partially correct |
83 ms |
12424 KB |
Partially correct |
27 |
Partially correct |
90 ms |
10832 KB |
Partially correct |
28 |
Partially correct |
74 ms |
9888 KB |
Partially correct |
29 |
Partially correct |
70 ms |
9628 KB |
Partially correct |
30 |
Partially correct |
193 ms |
14748 KB |
Partially correct |
31 |
Partially correct |
224 ms |
14332 KB |
Partially correct |
32 |
Partially correct |
86 ms |
10076 KB |
Partially correct |
33 |
Partially correct |
260 ms |
14408 KB |
Partially correct |
34 |
Partially correct |
243 ms |
14320 KB |
Partially correct |
35 |
Partially correct |
84 ms |
9820 KB |
Partially correct |
36 |
Partially correct |
78 ms |
9748 KB |
Partially correct |
37 |
Partially correct |
197 ms |
14604 KB |
Partially correct |
38 |
Partially correct |
214 ms |
14504 KB |
Partially correct |
39 |
Partially correct |
277 ms |
14084 KB |
Partially correct |
40 |
Partially correct |
136 ms |
13212 KB |
Partially correct |
41 |
Partially correct |
213 ms |
13884 KB |
Partially correct |
42 |
Partially correct |
72 ms |
9564 KB |
Partially correct |
43 |
Partially correct |
84 ms |
9756 KB |
Partially correct |
44 |
Partially correct |
213 ms |
14856 KB |
Partially correct |
45 |
Partially correct |
212 ms |
14420 KB |
Partially correct |
46 |
Partially correct |
88 ms |
11164 KB |
Partially correct |
47 |
Partially correct |
82 ms |
11360 KB |
Partially correct |
48 |
Partially correct |
96 ms |
11100 KB |
Partially correct |
49 |
Partially correct |
74 ms |
9424 KB |
Partially correct |
50 |
Partially correct |
78 ms |
9628 KB |
Partially correct |
51 |
Partially correct |
75 ms |
7256 KB |
Partially correct |
52 |
Incorrect |
76 ms |
7260 KB |
Not correct |
53 |
Halted |
0 ms |
0 KB |
- |