# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
65022 |
2018-08-06T12:58:40 Z |
bazsi700 |
007 (CEOI14_007) |
C++14 |
|
420 ms |
24296 KB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n,m,s,d,a,b;
cin >> n >> m >> s >> d >> a >> b;
vector<vector<int> > graph(n+1,vector<int>());
for(int i = 0; i < m; i++) {
int x,y;
cin >> x >> y;
graph[x].push_back(y);
graph[y].push_back(x);
}
vector<bool> wass(n+1,false);
vector<int> dists(n+1,0);
vector<bool> wasd(n+1,false);
vector<int> distd(n+1,0);
wass[s] = true;
queue<int> q;
q.push(s);
while(!q.empty()) {
int v = q.front();
q.pop();
for(int u : graph[v]) {
if(!wass[u]) {
wass[u] = true;
q.push(u);
dists[u] = dists[v]+1;
}
}
}
wasd[d] = true;
q.push(s);
while(!q.empty()) {
int v = q.front();
q.pop();
for(int u : graph[v]) {
if(!wasd[u]) {
wasd[u] = true;
q.push(u);
distd[u] = distd[v]+1;
}
}
}
cout << max(min(distd[a]-dists[a],distd[b]-dists[b]),-1);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
252 KB |
Output is correct |
2 |
Incorrect |
2 ms |
360 KB |
Output isn't correct |
3 |
Correct |
2 ms |
440 KB |
Output is correct |
4 |
Correct |
2 ms |
460 KB |
Output is correct |
5 |
Correct |
3 ms |
592 KB |
Output is correct |
6 |
Incorrect |
2 ms |
592 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
592 KB |
Output isn't correct |
8 |
Correct |
2 ms |
592 KB |
Output is correct |
9 |
Incorrect |
2 ms |
592 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
592 KB |
Output isn't correct |
11 |
Partially correct |
4 ms |
592 KB |
Partially correct |
12 |
Incorrect |
2 ms |
592 KB |
Output isn't correct |
13 |
Incorrect |
3 ms |
712 KB |
Output isn't correct |
14 |
Incorrect |
2 ms |
712 KB |
Output isn't correct |
15 |
Incorrect |
2 ms |
712 KB |
Output isn't correct |
16 |
Incorrect |
3 ms |
712 KB |
Output isn't correct |
17 |
Incorrect |
3 ms |
712 KB |
Output isn't correct |
18 |
Incorrect |
2 ms |
712 KB |
Output isn't correct |
19 |
Incorrect |
2 ms |
712 KB |
Output isn't correct |
20 |
Incorrect |
7 ms |
712 KB |
Output isn't correct |
21 |
Incorrect |
4 ms |
712 KB |
Output isn't correct |
22 |
Incorrect |
3 ms |
712 KB |
Output isn't correct |
23 |
Incorrect |
5 ms |
712 KB |
Output isn't correct |
24 |
Correct |
3 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
3804 KB |
Output isn't correct |
2 |
Incorrect |
47 ms |
5564 KB |
Output isn't correct |
3 |
Incorrect |
40 ms |
5564 KB |
Output isn't correct |
4 |
Incorrect |
52 ms |
7016 KB |
Output isn't correct |
5 |
Incorrect |
34 ms |
7016 KB |
Output isn't correct |
6 |
Incorrect |
53 ms |
7016 KB |
Output isn't correct |
7 |
Incorrect |
40 ms |
7704 KB |
Output isn't correct |
8 |
Incorrect |
65 ms |
8324 KB |
Output isn't correct |
9 |
Incorrect |
49 ms |
9708 KB |
Output isn't correct |
10 |
Incorrect |
180 ms |
16848 KB |
Output isn't correct |
11 |
Incorrect |
71 ms |
16848 KB |
Output isn't correct |
12 |
Incorrect |
96 ms |
16848 KB |
Output isn't correct |
13 |
Incorrect |
83 ms |
16848 KB |
Output isn't correct |
14 |
Incorrect |
59 ms |
16848 KB |
Output isn't correct |
15 |
Incorrect |
86 ms |
16848 KB |
Output isn't correct |
16 |
Incorrect |
88 ms |
16848 KB |
Output isn't correct |
17 |
Incorrect |
106 ms |
16848 KB |
Output isn't correct |
18 |
Incorrect |
112 ms |
16848 KB |
Output isn't correct |
19 |
Incorrect |
135 ms |
16848 KB |
Output isn't correct |
20 |
Incorrect |
257 ms |
19824 KB |
Output isn't correct |
21 |
Incorrect |
125 ms |
19824 KB |
Output isn't correct |
22 |
Incorrect |
120 ms |
19824 KB |
Output isn't correct |
23 |
Incorrect |
125 ms |
19824 KB |
Output isn't correct |
24 |
Incorrect |
175 ms |
19824 KB |
Output isn't correct |
25 |
Incorrect |
140 ms |
19824 KB |
Output isn't correct |
26 |
Incorrect |
141 ms |
19824 KB |
Output isn't correct |
27 |
Incorrect |
116 ms |
19824 KB |
Output isn't correct |
28 |
Incorrect |
148 ms |
19824 KB |
Output isn't correct |
29 |
Incorrect |
193 ms |
19824 KB |
Output isn't correct |
30 |
Incorrect |
324 ms |
20832 KB |
Output isn't correct |
31 |
Incorrect |
194 ms |
20832 KB |
Output isn't correct |
32 |
Incorrect |
135 ms |
20832 KB |
Output isn't correct |
33 |
Incorrect |
136 ms |
20832 KB |
Output isn't correct |
34 |
Incorrect |
185 ms |
20832 KB |
Output isn't correct |
35 |
Incorrect |
168 ms |
20832 KB |
Output isn't correct |
36 |
Incorrect |
159 ms |
20832 KB |
Output isn't correct |
37 |
Incorrect |
182 ms |
20968 KB |
Output isn't correct |
38 |
Incorrect |
196 ms |
20968 KB |
Output isn't correct |
39 |
Incorrect |
226 ms |
20968 KB |
Output isn't correct |
40 |
Incorrect |
273 ms |
22120 KB |
Output isn't correct |
41 |
Incorrect |
420 ms |
24296 KB |
Output isn't correct |