Submission #449942

# Submission time Handle Problem Language Result Execution time Memory
449942 2021-08-02T10:03:56 Z vanic 007 (CEOI14_007) C++14
0 / 100
251 ms 16300 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);
	for(int i=0; i<2; i++){
		memset(dist[i], -1, sizeof(dist[i]));
	}
	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 << 0 << '\n';
	return 0;
	if(dist[0][c]>dist[1][c] || dist[0][d]>dist[1][d]){
		cout << -1 << '\n';
	}
	else if(dist[0][c]==dist[1][c] || dist[0][d]==dist[1][d]){
		cout << 0 << '\n';
	}
	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 Correct 4 ms 6476 KB Output is correct
2 Incorrect 4 ms 6476 KB Output isn't correct
3 Correct 4 ms 6476 KB Output is correct
4 Correct 3 ms 6476 KB Output is correct
5 Correct 4 ms 6568 KB Output is correct
6 Incorrect 4 ms 6476 KB Output isn't correct
7 Incorrect 4 ms 6512 KB Output isn't correct
8 Correct 4 ms 6476 KB Output is correct
9 Incorrect 4 ms 6568 KB Output isn't correct
10 Incorrect 4 ms 6476 KB Output isn't correct
11 Partially correct 4 ms 6476 KB Partially 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 4 ms 6580 KB Output isn't correct
16 Incorrect 4 ms 6476 KB Output isn't correct
17 Incorrect 4 ms 6604 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 6476 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 6604 KB Output isn't correct
24 Correct 4 ms 6604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 7772 KB Output isn't correct
2 Incorrect 28 ms 8340 KB Output isn't correct
3 Incorrect 24 ms 7932 KB Output isn't correct
4 Incorrect 33 ms 8516 KB Output isn't correct
5 Incorrect 28 ms 7852 KB Output isn't correct
6 Incorrect 27 ms 7984 KB Output isn't correct
7 Incorrect 26 ms 8104 KB Output isn't correct
8 Incorrect 26 ms 8008 KB Output isn't correct
9 Incorrect 39 ms 8400 KB Output isn't correct
10 Incorrect 165 ms 12684 KB Output isn't correct
11 Incorrect 52 ms 9368 KB Output isn't correct
12 Incorrect 65 ms 10120 KB Output isn't correct
13 Incorrect 51 ms 9604 KB Output isn't correct
14 Incorrect 42 ms 9044 KB Output isn't correct
15 Incorrect 61 ms 10084 KB Output isn't correct
16 Incorrect 67 ms 10432 KB Output isn't correct
17 Incorrect 55 ms 9920 KB Output isn't correct
18 Incorrect 58 ms 9904 KB Output isn't correct
19 Incorrect 97 ms 11156 KB Output isn't correct
20 Incorrect 191 ms 13820 KB Output isn't correct
21 Incorrect 106 ms 11484 KB Output isn't correct
22 Incorrect 90 ms 10820 KB Output isn't correct
23 Incorrect 103 ms 11488 KB Output isn't correct
24 Incorrect 102 ms 11472 KB Output isn't correct
25 Incorrect 85 ms 11212 KB Output isn't correct
26 Incorrect 89 ms 10948 KB Output isn't correct
27 Incorrect 94 ms 11524 KB Output isn't correct
28 Incorrect 132 ms 11504 KB Output isn't correct
29 Incorrect 149 ms 12372 KB Output isn't correct
30 Incorrect 191 ms 14468 KB Output isn't correct
31 Incorrect 103 ms 12332 KB Output isn't correct
32 Incorrect 92 ms 11520 KB Output isn't correct
33 Incorrect 98 ms 11808 KB Output isn't correct
34 Incorrect 112 ms 11912 KB Output isn't correct
35 Incorrect 85 ms 11716 KB Output isn't correct
36 Incorrect 104 ms 11944 KB Output isn't correct
37 Incorrect 121 ms 12720 KB Output isn't correct
38 Incorrect 116 ms 12504 KB Output isn't correct
39 Incorrect 125 ms 12484 KB Output isn't correct
40 Incorrect 168 ms 14132 KB Output isn't correct
41 Incorrect 251 ms 16300 KB Output isn't correct