#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;
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++) reverse(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 |
4876 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
163 ms |
13088 KB |
Partially correct |
2 |
Partially correct |
186 ms |
12952 KB |
Partially correct |
3 |
Partially correct |
80 ms |
11688 KB |
Partially correct |
4 |
Partially correct |
75 ms |
11160 KB |
Partially correct |
5 |
Partially correct |
157 ms |
12448 KB |
Partially correct |
6 |
Partially correct |
64 ms |
10652 KB |
Partially correct |
7 |
Partially correct |
67 ms |
10640 KB |
Partially correct |
8 |
Partially correct |
174 ms |
12868 KB |
Partially correct |
9 |
Partially correct |
171 ms |
12940 KB |
Partially correct |
10 |
Partially correct |
119 ms |
11972 KB |
Partially correct |
11 |
Partially correct |
76 ms |
11416 KB |
Partially correct |
12 |
Partially correct |
211 ms |
13744 KB |
Partially correct |
13 |
Partially correct |
67 ms |
10660 KB |
Partially correct |
14 |
Partially correct |
72 ms |
10656 KB |
Partially correct |
15 |
Partially correct |
177 ms |
13212 KB |
Partially correct |
16 |
Partially correct |
194 ms |
12960 KB |
Partially correct |
17 |
Partially correct |
108 ms |
11668 KB |
Partially correct |
18 |
Partially correct |
75 ms |
11292 KB |
Partially correct |
19 |
Partially correct |
123 ms |
12040 KB |
Partially correct |
20 |
Partially correct |
70 ms |
10704 KB |
Partially correct |
21 |
Partially correct |
70 ms |
10664 KB |
Partially correct |
22 |
Partially correct |
164 ms |
13312 KB |
Partially correct |
23 |
Partially correct |
168 ms |
13420 KB |
Partially correct |
24 |
Partially correct |
72 ms |
10920 KB |
Partially correct |
25 |
Partially correct |
70 ms |
11196 KB |
Partially correct |
26 |
Partially correct |
72 ms |
10912 KB |
Partially correct |
27 |
Partially correct |
70 ms |
10640 KB |
Partially correct |
28 |
Partially correct |
64 ms |
10648 KB |
Partially correct |
29 |
Partially correct |
181 ms |
13132 KB |
Partially correct |
30 |
Partially correct |
182 ms |
12812 KB |
Partially correct |
31 |
Partially correct |
76 ms |
10900 KB |
Partially correct |
32 |
Partially correct |
205 ms |
13240 KB |
Partially correct |
33 |
Partially correct |
192 ms |
12700 KB |
Partially correct |
34 |
Partially correct |
67 ms |
10900 KB |
Partially correct |
35 |
Partially correct |
64 ms |
10660 KB |
Partially correct |
36 |
Partially correct |
176 ms |
13076 KB |
Partially correct |
37 |
Partially correct |
165 ms |
12784 KB |
Partially correct |
38 |
Partially correct |
236 ms |
13140 KB |
Partially correct |
39 |
Partially correct |
122 ms |
11684 KB |
Partially correct |
40 |
Partially correct |
167 ms |
12540 KB |
Partially correct |
41 |
Partially correct |
70 ms |
10660 KB |
Partially correct |
42 |
Partially correct |
64 ms |
10660 KB |
Partially correct |
43 |
Partially correct |
167 ms |
13436 KB |
Partially correct |
44 |
Partially correct |
180 ms |
12908 KB |
Partially correct |
45 |
Partially correct |
78 ms |
11044 KB |
Partially correct |
46 |
Partially correct |
66 ms |
11156 KB |
Partially correct |
47 |
Partially correct |
84 ms |
11764 KB |
Partially correct |
48 |
Partially correct |
71 ms |
10660 KB |
Partially correct |
49 |
Partially correct |
67 ms |
10660 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
64 ms |
10136 KB |
Partially correct |
2 |
Incorrect |
70 ms |
10144 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
4876 KB |
Partially correct |
2 |
Partially correct |
163 ms |
13088 KB |
Partially correct |
3 |
Partially correct |
186 ms |
12952 KB |
Partially correct |
4 |
Partially correct |
80 ms |
11688 KB |
Partially correct |
5 |
Partially correct |
75 ms |
11160 KB |
Partially correct |
6 |
Partially correct |
157 ms |
12448 KB |
Partially correct |
7 |
Partially correct |
64 ms |
10652 KB |
Partially correct |
8 |
Partially correct |
67 ms |
10640 KB |
Partially correct |
9 |
Partially correct |
174 ms |
12868 KB |
Partially correct |
10 |
Partially correct |
171 ms |
12940 KB |
Partially correct |
11 |
Partially correct |
119 ms |
11972 KB |
Partially correct |
12 |
Partially correct |
76 ms |
11416 KB |
Partially correct |
13 |
Partially correct |
211 ms |
13744 KB |
Partially correct |
14 |
Partially correct |
67 ms |
10660 KB |
Partially correct |
15 |
Partially correct |
72 ms |
10656 KB |
Partially correct |
16 |
Partially correct |
177 ms |
13212 KB |
Partially correct |
17 |
Partially correct |
194 ms |
12960 KB |
Partially correct |
18 |
Partially correct |
108 ms |
11668 KB |
Partially correct |
19 |
Partially correct |
75 ms |
11292 KB |
Partially correct |
20 |
Partially correct |
123 ms |
12040 KB |
Partially correct |
21 |
Partially correct |
70 ms |
10704 KB |
Partially correct |
22 |
Partially correct |
70 ms |
10664 KB |
Partially correct |
23 |
Partially correct |
164 ms |
13312 KB |
Partially correct |
24 |
Partially correct |
168 ms |
13420 KB |
Partially correct |
25 |
Partially correct |
72 ms |
10920 KB |
Partially correct |
26 |
Partially correct |
70 ms |
11196 KB |
Partially correct |
27 |
Partially correct |
72 ms |
10912 KB |
Partially correct |
28 |
Partially correct |
70 ms |
10640 KB |
Partially correct |
29 |
Partially correct |
64 ms |
10648 KB |
Partially correct |
30 |
Partially correct |
181 ms |
13132 KB |
Partially correct |
31 |
Partially correct |
182 ms |
12812 KB |
Partially correct |
32 |
Partially correct |
76 ms |
10900 KB |
Partially correct |
33 |
Partially correct |
205 ms |
13240 KB |
Partially correct |
34 |
Partially correct |
192 ms |
12700 KB |
Partially correct |
35 |
Partially correct |
67 ms |
10900 KB |
Partially correct |
36 |
Partially correct |
64 ms |
10660 KB |
Partially correct |
37 |
Partially correct |
176 ms |
13076 KB |
Partially correct |
38 |
Partially correct |
165 ms |
12784 KB |
Partially correct |
39 |
Partially correct |
236 ms |
13140 KB |
Partially correct |
40 |
Partially correct |
122 ms |
11684 KB |
Partially correct |
41 |
Partially correct |
167 ms |
12540 KB |
Partially correct |
42 |
Partially correct |
70 ms |
10660 KB |
Partially correct |
43 |
Partially correct |
64 ms |
10660 KB |
Partially correct |
44 |
Partially correct |
167 ms |
13436 KB |
Partially correct |
45 |
Partially correct |
180 ms |
12908 KB |
Partially correct |
46 |
Partially correct |
78 ms |
11044 KB |
Partially correct |
47 |
Partially correct |
66 ms |
11156 KB |
Partially correct |
48 |
Partially correct |
84 ms |
11764 KB |
Partially correct |
49 |
Partially correct |
71 ms |
10660 KB |
Partially correct |
50 |
Partially correct |
67 ms |
10660 KB |
Partially correct |
51 |
Partially correct |
64 ms |
10136 KB |
Partially correct |
52 |
Incorrect |
70 ms |
10144 KB |
Not correct |
53 |
Halted |
0 ms |
0 KB |
- |