#include <bits/stdc++.h>
#include "incursion.h"
#define pb push_back
using namespace std;
const int N=5e4+5;
int dis1[N],dis2[N],n;
vector<int> adj2[N],adj1[N];
bool found;
void dfs1(int x,int p){
for (auto u:adj1[x]){
if (u==p) continue;
dis1[u]=dis1[x]+1;
dfs1(u,x);
}return;
}
void dfs2(int x,int p){
//cout<<x<<' '<<p<<endl;
if (dis2[x]==0){
found=1;
return;
}
for (auto u:adj2[x]){
if (u==p) continue;
dis2[u]=visit(u);
if (dis2[u]==0){
found=1;
return;
}
if (dis2[u]>dis2[x]) visit(x);
else{
dfs2(u,x);
return;
}
}
return;
}
std::vector<int> mark(std::vector<std::pair<int, int>> F, int safe) {
n=F.size()+1;
for (auto u:F){
adj1[u.first].pb(u.second);
adj1[u.second].pb(u.first);
}
dfs1(safe,0);
vector<int> v;
for (int i=1;i<=n;i++) v.pb(dis1[i]);
return v;
}
void locate(std::vector<std::pair<int, int>> F, int curr, int t) {
n=F.size()+1;
dis2[curr]=t;
for (auto u:F){
adj2[u.first].pb(u.second);
adj2[u.second].pb(u.first);
}
dfs2(curr,0);
return;
}
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);
| ~~~~~~~~~~~~~~~^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
5392 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
193 ms |
11936 KB |
Partially correct |
2 |
Partially correct |
229 ms |
11748 KB |
Partially correct |
3 |
Partially correct |
96 ms |
11932 KB |
Partially correct |
4 |
Partially correct |
101 ms |
11380 KB |
Partially correct |
5 |
Partially correct |
181 ms |
11552 KB |
Partially correct |
6 |
Partially correct |
70 ms |
10788 KB |
Partially correct |
7 |
Partially correct |
81 ms |
10796 KB |
Partially correct |
8 |
Partially correct |
182 ms |
12040 KB |
Partially correct |
9 |
Partially correct |
200 ms |
11812 KB |
Partially correct |
10 |
Partially correct |
154 ms |
11344 KB |
Partially correct |
11 |
Partially correct |
107 ms |
11400 KB |
Partially correct |
12 |
Partially correct |
260 ms |
11808 KB |
Partially correct |
13 |
Partially correct |
78 ms |
10760 KB |
Partially correct |
14 |
Partially correct |
80 ms |
10772 KB |
Partially correct |
15 |
Partially correct |
222 ms |
11804 KB |
Partially correct |
16 |
Partially correct |
221 ms |
11904 KB |
Partially correct |
17 |
Partially correct |
132 ms |
11664 KB |
Partially correct |
18 |
Partially correct |
75 ms |
11768 KB |
Partially correct |
19 |
Partially correct |
143 ms |
11300 KB |
Partially correct |
20 |
Partially correct |
75 ms |
10772 KB |
Partially correct |
21 |
Partially correct |
78 ms |
10896 KB |
Partially correct |
22 |
Partially correct |
221 ms |
11900 KB |
Partially correct |
23 |
Partially correct |
212 ms |
11808 KB |
Partially correct |
24 |
Partially correct |
94 ms |
11436 KB |
Partially correct |
25 |
Partially correct |
84 ms |
11664 KB |
Partially correct |
26 |
Partially correct |
94 ms |
11404 KB |
Partially correct |
27 |
Partially correct |
76 ms |
10784 KB |
Partially correct |
28 |
Partially correct |
70 ms |
10764 KB |
Partially correct |
29 |
Partially correct |
206 ms |
11932 KB |
Partially correct |
30 |
Partially correct |
210 ms |
11948 KB |
Partially correct |
31 |
Partially correct |
78 ms |
11152 KB |
Partially correct |
32 |
Partially correct |
253 ms |
11780 KB |
Partially correct |
33 |
Partially correct |
230 ms |
11552 KB |
Partially correct |
34 |
Partially correct |
79 ms |
10772 KB |
Partially correct |
35 |
Partially correct |
78 ms |
10912 KB |
Partially correct |
36 |
Partially correct |
226 ms |
11932 KB |
Partially correct |
37 |
Partially correct |
212 ms |
11936 KB |
Partially correct |
38 |
Partially correct |
256 ms |
11564 KB |
Partially correct |
39 |
Partially correct |
137 ms |
11856 KB |
Partially correct |
40 |
Partially correct |
183 ms |
11804 KB |
Partially correct |
41 |
Partially correct |
78 ms |
10788 KB |
Partially correct |
42 |
Partially correct |
71 ms |
10756 KB |
Partially correct |
43 |
Partially correct |
214 ms |
12172 KB |
Partially correct |
44 |
Partially correct |
203 ms |
12028 KB |
Partially correct |
45 |
Partially correct |
93 ms |
11536 KB |
Partially correct |
46 |
Partially correct |
81 ms |
11804 KB |
Partially correct |
47 |
Partially correct |
95 ms |
11668 KB |
Partially correct |
48 |
Partially correct |
74 ms |
10764 KB |
Partially correct |
49 |
Partially correct |
74 ms |
10780 KB |
Partially correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
76 ms |
10140 KB |
Partially correct |
2 |
Incorrect |
74 ms |
10284 KB |
Not correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
2 ms |
5392 KB |
Partially correct |
2 |
Partially correct |
193 ms |
11936 KB |
Partially correct |
3 |
Partially correct |
229 ms |
11748 KB |
Partially correct |
4 |
Partially correct |
96 ms |
11932 KB |
Partially correct |
5 |
Partially correct |
101 ms |
11380 KB |
Partially correct |
6 |
Partially correct |
181 ms |
11552 KB |
Partially correct |
7 |
Partially correct |
70 ms |
10788 KB |
Partially correct |
8 |
Partially correct |
81 ms |
10796 KB |
Partially correct |
9 |
Partially correct |
182 ms |
12040 KB |
Partially correct |
10 |
Partially correct |
200 ms |
11812 KB |
Partially correct |
11 |
Partially correct |
154 ms |
11344 KB |
Partially correct |
12 |
Partially correct |
107 ms |
11400 KB |
Partially correct |
13 |
Partially correct |
260 ms |
11808 KB |
Partially correct |
14 |
Partially correct |
78 ms |
10760 KB |
Partially correct |
15 |
Partially correct |
80 ms |
10772 KB |
Partially correct |
16 |
Partially correct |
222 ms |
11804 KB |
Partially correct |
17 |
Partially correct |
221 ms |
11904 KB |
Partially correct |
18 |
Partially correct |
132 ms |
11664 KB |
Partially correct |
19 |
Partially correct |
75 ms |
11768 KB |
Partially correct |
20 |
Partially correct |
143 ms |
11300 KB |
Partially correct |
21 |
Partially correct |
75 ms |
10772 KB |
Partially correct |
22 |
Partially correct |
78 ms |
10896 KB |
Partially correct |
23 |
Partially correct |
221 ms |
11900 KB |
Partially correct |
24 |
Partially correct |
212 ms |
11808 KB |
Partially correct |
25 |
Partially correct |
94 ms |
11436 KB |
Partially correct |
26 |
Partially correct |
84 ms |
11664 KB |
Partially correct |
27 |
Partially correct |
94 ms |
11404 KB |
Partially correct |
28 |
Partially correct |
76 ms |
10784 KB |
Partially correct |
29 |
Partially correct |
70 ms |
10764 KB |
Partially correct |
30 |
Partially correct |
206 ms |
11932 KB |
Partially correct |
31 |
Partially correct |
210 ms |
11948 KB |
Partially correct |
32 |
Partially correct |
78 ms |
11152 KB |
Partially correct |
33 |
Partially correct |
253 ms |
11780 KB |
Partially correct |
34 |
Partially correct |
230 ms |
11552 KB |
Partially correct |
35 |
Partially correct |
79 ms |
10772 KB |
Partially correct |
36 |
Partially correct |
78 ms |
10912 KB |
Partially correct |
37 |
Partially correct |
226 ms |
11932 KB |
Partially correct |
38 |
Partially correct |
212 ms |
11936 KB |
Partially correct |
39 |
Partially correct |
256 ms |
11564 KB |
Partially correct |
40 |
Partially correct |
137 ms |
11856 KB |
Partially correct |
41 |
Partially correct |
183 ms |
11804 KB |
Partially correct |
42 |
Partially correct |
78 ms |
10788 KB |
Partially correct |
43 |
Partially correct |
71 ms |
10756 KB |
Partially correct |
44 |
Partially correct |
214 ms |
12172 KB |
Partially correct |
45 |
Partially correct |
203 ms |
12028 KB |
Partially correct |
46 |
Partially correct |
93 ms |
11536 KB |
Partially correct |
47 |
Partially correct |
81 ms |
11804 KB |
Partially correct |
48 |
Partially correct |
95 ms |
11668 KB |
Partially correct |
49 |
Partially correct |
74 ms |
10764 KB |
Partially correct |
50 |
Partially correct |
74 ms |
10780 KB |
Partially correct |
51 |
Partially correct |
76 ms |
10140 KB |
Partially correct |
52 |
Incorrect |
74 ms |
10284 KB |
Not correct |
53 |
Halted |
0 ms |
0 KB |
- |