#include "incursion.h"
#include <bits/stdc++.h>
using namespace std;
namespace asdf {
const int Nmax=45010;
int N;
vector<int> adj[Nmax], ret;
void DFS(int curr, int prev, int x) {
ret[curr-1]=x;
for(int next:adj[curr]) if(next!=prev) DFS(next, curr, x+1);
}
vector<int> mark(vector<pair<int, int>> F, int safe) {
N=F.size()+1;
for(int i=0; i<N-1; i++) adj[F[i].first].push_back(F[i].second), adj[F[i].second].push_back(F[i].first);
ret.resize(N);
DFS(safe, -1, 0);
return ret;
}
}
namespace qwer {
const int Nmax=45010;
int N, cnt=0;
vector<int> adj[Nmax];
bool DFS(int curr, int prev, int val) {
for(int next:adj[curr]) if(next!=prev) {
int tmp=visit(next);
if(!tmp) return true;
if(tmp<val) {
if(DFS(next, curr, tmp)) return true;
visit(curr);
}
else visit(curr);
}
return false;
}
void locate(vector<pair<int, int>> F, int curr, int t) {
N=F.size()+1;
for(int i=0; i<N-1; i++) adj[F[i].first].push_back(F[i].second), adj[F[i].second].push_back(F[i].first);
for(int i=1; i<=N; i++) {
int t=rand()%3;
for(int j=0; j<t; j++) next_permutation(adj[i].begin(), adj[i].end());
}
if(!t) return;
DFS(curr, 0, t);
}
}
std::vector<int> mark(std::vector<std::pair<int, int>> F, int safe) {
return asdf::mark(F, safe);
}
void locate(std::vector<std::pair<int, int>> F, int curr, int t) {
qwer::locate(F, curr, 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 |
2 ms |
4868 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
156 ms |
13016 KB |
Partially correct |
2 |
Partially correct |
176 ms |
12964 KB |
Partially correct |
3 |
Partially correct |
92 ms |
11880 KB |
Partially correct |
4 |
Partially correct |
82 ms |
11220 KB |
Partially correct |
5 |
Partially correct |
189 ms |
12692 KB |
Partially correct |
6 |
Partially correct |
64 ms |
10660 KB |
Partially correct |
7 |
Partially correct |
70 ms |
10656 KB |
Partially correct |
8 |
Partially correct |
181 ms |
13032 KB |
Partially correct |
9 |
Partially correct |
170 ms |
12696 KB |
Partially correct |
10 |
Partially correct |
119 ms |
11504 KB |
Partially correct |
11 |
Partially correct |
88 ms |
11416 KB |
Partially correct |
12 |
Partially correct |
223 ms |
13568 KB |
Partially correct |
13 |
Partially correct |
70 ms |
10664 KB |
Partially correct |
14 |
Partially correct |
71 ms |
10648 KB |
Partially correct |
15 |
Partially correct |
180 ms |
13092 KB |
Partially correct |
16 |
Partially correct |
161 ms |
13280 KB |
Partially correct |
17 |
Partially correct |
106 ms |
11852 KB |
Partially correct |
18 |
Partially correct |
80 ms |
11416 KB |
Partially correct |
19 |
Partially correct |
124 ms |
12184 KB |
Partially correct |
20 |
Partially correct |
66 ms |
10656 KB |
Partially correct |
21 |
Partially correct |
67 ms |
10632 KB |
Partially correct |
22 |
Partially correct |
156 ms |
13292 KB |
Partially correct |
23 |
Partially correct |
171 ms |
13444 KB |
Partially correct |
24 |
Partially correct |
75 ms |
11084 KB |
Partially correct |
25 |
Partially correct |
67 ms |
11172 KB |
Partially correct |
26 |
Partially correct |
71 ms |
10912 KB |
Partially correct |
27 |
Partially correct |
66 ms |
10644 KB |
Partially correct |
28 |
Partially correct |
71 ms |
10668 KB |
Partially correct |
29 |
Partially correct |
177 ms |
12760 KB |
Partially correct |
30 |
Partially correct |
177 ms |
12924 KB |
Partially correct |
31 |
Partially correct |
90 ms |
10928 KB |
Partially correct |
32 |
Partially correct |
220 ms |
13132 KB |
Partially correct |
33 |
Partially correct |
209 ms |
13228 KB |
Partially correct |
34 |
Partially correct |
67 ms |
10652 KB |
Partially correct |
35 |
Partially correct |
76 ms |
10648 KB |
Partially correct |
36 |
Partially correct |
191 ms |
13132 KB |
Partially correct |
37 |
Partially correct |
179 ms |
13060 KB |
Partially correct |
38 |
Partially correct |
206 ms |
13444 KB |
Partially correct |
39 |
Partially correct |
112 ms |
11860 KB |
Partially correct |
40 |
Partially correct |
160 ms |
13260 KB |
Partially correct |
41 |
Partially correct |
69 ms |
10636 KB |
Partially correct |
42 |
Partially correct |
73 ms |
10644 KB |
Partially correct |
43 |
Partially correct |
179 ms |
12892 KB |
Partially correct |
44 |
Partially correct |
204 ms |
12860 KB |
Partially correct |
45 |
Partially correct |
78 ms |
11184 KB |
Partially correct |
46 |
Partially correct |
60 ms |
11156 KB |
Partially correct |
47 |
Partially correct |
98 ms |
11152 KB |
Partially correct |
48 |
Partially correct |
71 ms |
10648 KB |
Partially correct |
49 |
Partially correct |
59 ms |
10900 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
70 ms |
10148 KB |
Partially correct |
2 |
Incorrect |
64 ms |
10140 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
4868 KB |
Partially correct |
2 |
Partially correct |
156 ms |
13016 KB |
Partially correct |
3 |
Partially correct |
176 ms |
12964 KB |
Partially correct |
4 |
Partially correct |
92 ms |
11880 KB |
Partially correct |
5 |
Partially correct |
82 ms |
11220 KB |
Partially correct |
6 |
Partially correct |
189 ms |
12692 KB |
Partially correct |
7 |
Partially correct |
64 ms |
10660 KB |
Partially correct |
8 |
Partially correct |
70 ms |
10656 KB |
Partially correct |
9 |
Partially correct |
181 ms |
13032 KB |
Partially correct |
10 |
Partially correct |
170 ms |
12696 KB |
Partially correct |
11 |
Partially correct |
119 ms |
11504 KB |
Partially correct |
12 |
Partially correct |
88 ms |
11416 KB |
Partially correct |
13 |
Partially correct |
223 ms |
13568 KB |
Partially correct |
14 |
Partially correct |
70 ms |
10664 KB |
Partially correct |
15 |
Partially correct |
71 ms |
10648 KB |
Partially correct |
16 |
Partially correct |
180 ms |
13092 KB |
Partially correct |
17 |
Partially correct |
161 ms |
13280 KB |
Partially correct |
18 |
Partially correct |
106 ms |
11852 KB |
Partially correct |
19 |
Partially correct |
80 ms |
11416 KB |
Partially correct |
20 |
Partially correct |
124 ms |
12184 KB |
Partially correct |
21 |
Partially correct |
66 ms |
10656 KB |
Partially correct |
22 |
Partially correct |
67 ms |
10632 KB |
Partially correct |
23 |
Partially correct |
156 ms |
13292 KB |
Partially correct |
24 |
Partially correct |
171 ms |
13444 KB |
Partially correct |
25 |
Partially correct |
75 ms |
11084 KB |
Partially correct |
26 |
Partially correct |
67 ms |
11172 KB |
Partially correct |
27 |
Partially correct |
71 ms |
10912 KB |
Partially correct |
28 |
Partially correct |
66 ms |
10644 KB |
Partially correct |
29 |
Partially correct |
71 ms |
10668 KB |
Partially correct |
30 |
Partially correct |
177 ms |
12760 KB |
Partially correct |
31 |
Partially correct |
177 ms |
12924 KB |
Partially correct |
32 |
Partially correct |
90 ms |
10928 KB |
Partially correct |
33 |
Partially correct |
220 ms |
13132 KB |
Partially correct |
34 |
Partially correct |
209 ms |
13228 KB |
Partially correct |
35 |
Partially correct |
67 ms |
10652 KB |
Partially correct |
36 |
Partially correct |
76 ms |
10648 KB |
Partially correct |
37 |
Partially correct |
191 ms |
13132 KB |
Partially correct |
38 |
Partially correct |
179 ms |
13060 KB |
Partially correct |
39 |
Partially correct |
206 ms |
13444 KB |
Partially correct |
40 |
Partially correct |
112 ms |
11860 KB |
Partially correct |
41 |
Partially correct |
160 ms |
13260 KB |
Partially correct |
42 |
Partially correct |
69 ms |
10636 KB |
Partially correct |
43 |
Partially correct |
73 ms |
10644 KB |
Partially correct |
44 |
Partially correct |
179 ms |
12892 KB |
Partially correct |
45 |
Partially correct |
204 ms |
12860 KB |
Partially correct |
46 |
Partially correct |
78 ms |
11184 KB |
Partially correct |
47 |
Partially correct |
60 ms |
11156 KB |
Partially correct |
48 |
Partially correct |
98 ms |
11152 KB |
Partially correct |
49 |
Partially correct |
71 ms |
10648 KB |
Partially correct |
50 |
Partially correct |
59 ms |
10900 KB |
Partially correct |
51 |
Partially correct |
70 ms |
10148 KB |
Partially correct |
52 |
Incorrect |
64 ms |
10140 KB |
Not correct |
53 |
Halted |
0 ms |
0 KB |
- |