Submission #449698

# Submission time Handle Problem Language Result Execution time Memory
449698 2021-08-02T07:51:39 Z vanic 007 (CEOI14_007) C++14
0 / 100
247 ms 16272 KB
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cstring>
#include <queue>
#include <cassert>

using namespace std;

const int maxn=2e5+5;

vector < int > ms[maxn];
int dist[2][maxn];

void bfs(int x, int ind){
	queue < int > q;
	q.push(x);
	dist[ind][x]=0;
	while(!q.empty()){
		x=q.front();
		q.pop();
		for(int i=0; i<(int)ms[x].size(); i++){
			if(dist[ind][ms[x][i]]==-1){
				dist[ind][ms[x][i]]=dist[ind][x]+1;
				q.push(ms[x][i]);
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	memset(dist, -1, sizeof(dist));
	int n, m;
	cin >> n >> m;
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	a--; b--; c--; d--;
	int x, y;
	for(int i=0; i<m; i++){
		cin >> x >> y;
		x--; y--;
		ms[x].push_back(y);
		ms[y].push_back(x);
	}
	bfs(a, 0);
	bfs(b, 1);
	cout << -1 << '\n';
	return 0;
	if(dist[0][c]>dist[1][c] || dist[0][d]>dist[1][d]){
	}
	else{
//		assert(0);
		cout << min(dist[1][c]-dist[0][c], dist[1][d]-dist[0][d]) << '\n';
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Partially correct 4 ms 6476 KB Partially correct
2 Incorrect 7 ms 6476 KB Output isn't correct
3 Partially correct 4 ms 6476 KB Partially correct
4 Partially correct 4 ms 6476 KB Partially correct
5 Partially correct 4 ms 6476 KB Partially correct
6 Incorrect 4 ms 6476 KB Output isn't correct
7 Incorrect 7 ms 6576 KB Output isn't correct
8 Partially correct 4 ms 6476 KB Partially correct
9 Incorrect 7 ms 6476 KB Output isn't correct
10 Incorrect 4 ms 6476 KB Output isn't correct
11 Incorrect 4 ms 6580 KB Output isn't correct
12 Incorrect 4 ms 6476 KB Output isn't correct
13 Incorrect 4 ms 6476 KB Output isn't correct
14 Incorrect 4 ms 6476 KB Output isn't correct
15 Incorrect 5 ms 6476 KB Output isn't correct
16 Incorrect 4 ms 6476 KB Output isn't correct
17 Incorrect 4 ms 6476 KB Output isn't correct
18 Incorrect 4 ms 6476 KB Output isn't correct
19 Incorrect 4 ms 6476 KB Output isn't correct
20 Incorrect 4 ms 6604 KB Output isn't correct
21 Incorrect 4 ms 6476 KB Output isn't correct
22 Incorrect 4 ms 6476 KB Output isn't correct
23 Incorrect 4 ms 6476 KB Output isn't correct
24 Partially correct 5 ms 6604 KB Partially correct
# Verdict Execution time Memory Grader output
1 Incorrect 56 ms 7840 KB Output isn't correct
2 Incorrect 28 ms 8404 KB Output isn't correct
3 Incorrect 48 ms 7884 KB Output isn't correct
4 Incorrect 31 ms 8404 KB Output isn't correct
5 Incorrect 22 ms 7716 KB Output isn't correct
6 Incorrect 28 ms 7936 KB Output isn't correct
7 Incorrect 27 ms 8120 KB Output isn't correct
8 Incorrect 26 ms 8012 KB Output isn't correct
9 Incorrect 54 ms 8396 KB Output isn't correct
10 Incorrect 145 ms 12628 KB Output isn't correct
11 Incorrect 47 ms 9380 KB Output isn't correct
12 Incorrect 73 ms 10052 KB Output isn't correct
13 Incorrect 62 ms 9664 KB Output isn't correct
14 Correct 48 ms 9052 KB Output is correct
15 Incorrect 64 ms 10180 KB Output isn't correct
16 Incorrect 74 ms 10332 KB Output isn't correct
17 Incorrect 67 ms 9968 KB Output isn't correct
18 Incorrect 88 ms 9980 KB Output isn't correct
19 Incorrect 119 ms 11048 KB Output isn't correct
20 Incorrect 222 ms 13852 KB Output isn't correct
21 Incorrect 94 ms 11588 KB Output isn't correct
22 Incorrect 93 ms 10864 KB Output isn't correct
23 Incorrect 83 ms 11460 KB Output isn't correct
24 Incorrect 85 ms 11468 KB Output isn't correct
25 Incorrect 90 ms 11112 KB Output isn't correct
26 Incorrect 84 ms 10944 KB Output isn't correct
27 Incorrect 109 ms 11588 KB Output isn't correct
28 Incorrect 97 ms 11504 KB Output isn't correct
29 Incorrect 119 ms 12336 KB Output isn't correct
30 Incorrect 195 ms 14408 KB Output isn't correct
31 Incorrect 121 ms 12324 KB Output isn't correct
32 Incorrect 116 ms 11544 KB Output isn't correct
33 Incorrect 99 ms 11692 KB Output isn't correct
34 Incorrect 120 ms 11884 KB Output isn't correct
35 Incorrect 105 ms 11696 KB Output isn't correct
36 Incorrect 102 ms 11944 KB Output isn't correct
37 Incorrect 123 ms 12548 KB Output isn't correct
38 Incorrect 136 ms 12508 KB Output isn't correct
39 Incorrect 152 ms 12488 KB Output isn't correct
40 Incorrect 181 ms 14084 KB Output isn't correct
41 Incorrect 247 ms 16272 KB Output isn't correct