답안 #243272

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
243272 2020-06-30T16:40:33 Z BamiTorabi 007 (CEOI14_007) C++14
0 / 100
380 ms 18040 KB
//Sasayego! Sasayego! Shinzou wo Sasageyo!

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bitset>
#include <ctime>
#define debug(x)  cerr << #x << " = " << x << endl
#define lid (id << 1)
#define rid (lid ^ 1)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;

const int maxN = 2e5 + 5;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int dist[4][maxN];
queue <int> Q;
vector <int> G[maxN];

void BFS(int ix, int st){
	dist[ix][st] = 0;
	Q.push(st);
	while (!Q.empty()){
		int v = Q.front(); Q.pop();
		for (int u : G[v])
			if (dist[ix][u] > dist[ix][v] + 1){
				dist[ix][u] = dist[ix][v] + 1;
				Q.push(u);
			}
	}
	return;
}

int main(){
	time_t START = clock();
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	memset(dist, 63, sizeof dist);
	int n, m, s, t, a, b;
	scanf("%d%d%d%d%d%d", &n, &m, &s, &t, &a, &b);
	while (m--){
		int u, v; scanf("%d%d", &u, &v);
		G[u].push_back(v);
		G[v].push_back(u);
	}
	BFS(0, s);
	BFS(1, t);
	BFS(2, a);
	BFS(3, b);
	return printf("-2\n"), 0;
	if (dist[2][t] < dist[2][s] || dist[3][t] < dist[b][s])
		return printf("-1\n"), 0;
	if (dist[2][t] - dist[2][s] != dist[3][t] - dist[3][s])
		return printf("%d\n", min(dist[2][t] - dist[2][s], dist[3][t] - dist[3][s])), 0;
	int mns = n, mnt = n;
	for (int i = 1; i <= n; i++){
		if (dist[0][i] + dist[2][i] == dist[2][s] && dist[0][i] + dist[3][i] == dist[3][s])
			mns = min(mns, dist[2][i]);
		if (dist[1][i] + dist[2][i] == dist[2][t] && dist[1][i] + dist[3][i] == dist[3][t])
			mnt = min(mnt, dist[3][i]);
	}
	printf("%d\n", dist[2][t] - dist[2][s] - (mnt > mns));
	time_t FINISH = clock();
	cerr << "Execution time: " << (ld)(FINISH - START) / CLOCKS_PER_SEC * 1000.0 << " milliseconds.\n";
	return 0;
}
 

Compilation message

007.cpp: In function 'int main()':
007.cpp:54:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d%d%d%d", &n, &m, &s, &t, &a, &b);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
007.cpp:56:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int u, v; scanf("%d%d", &u, &v);
             ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 8192 KB Output isn't correct
2 Incorrect 9 ms 8192 KB Output isn't correct
3 Incorrect 9 ms 8192 KB Output isn't correct
4 Incorrect 9 ms 8192 KB Output isn't correct
5 Incorrect 9 ms 8192 KB Output isn't correct
6 Incorrect 9 ms 8192 KB Output isn't correct
7 Incorrect 10 ms 8192 KB Output isn't correct
8 Incorrect 10 ms 8192 KB Output isn't correct
9 Incorrect 9 ms 8192 KB Output isn't correct
10 Incorrect 9 ms 8192 KB Output isn't correct
11 Incorrect 9 ms 8192 KB Output isn't correct
12 Incorrect 11 ms 8192 KB Output isn't correct
13 Incorrect 9 ms 8192 KB Output isn't correct
14 Incorrect 9 ms 8192 KB Output isn't correct
15 Incorrect 9 ms 8192 KB Output isn't correct
16 Incorrect 9 ms 8192 KB Output isn't correct
17 Incorrect 9 ms 8192 KB Output isn't correct
18 Incorrect 9 ms 8192 KB Output isn't correct
19 Incorrect 10 ms 8192 KB Output isn't correct
20 Incorrect 9 ms 8192 KB Output isn't correct
21 Incorrect 9 ms 8192 KB Output isn't correct
22 Incorrect 10 ms 8192 KB Output isn't correct
23 Incorrect 9 ms 8192 KB Output isn't correct
24 Incorrect 9 ms 8192 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 34 ms 9472 KB Output isn't correct
2 Incorrect 65 ms 9976 KB Output isn't correct
3 Incorrect 55 ms 9592 KB Output isn't correct
4 Incorrect 57 ms 10104 KB Output isn't correct
5 Incorrect 34 ms 9344 KB Output isn't correct
6 Incorrect 34 ms 9600 KB Output isn't correct
7 Incorrect 38 ms 9728 KB Output isn't correct
8 Incorrect 48 ms 9728 KB Output isn't correct
9 Incorrect 53 ms 10104 KB Output isn't correct
10 Incorrect 179 ms 14328 KB Output isn't correct
11 Incorrect 80 ms 11000 KB Output isn't correct
12 Incorrect 103 ms 11896 KB Output isn't correct
13 Incorrect 83 ms 11256 KB Output isn't correct
14 Partially correct 68 ms 10744 KB Partially correct
15 Incorrect 96 ms 11896 KB Output isn't correct
16 Incorrect 99 ms 12024 KB Output isn't correct
17 Incorrect 91 ms 11512 KB Output isn't correct
18 Incorrect 114 ms 11768 KB Output isn't correct
19 Incorrect 130 ms 12792 KB Output isn't correct
20 Incorrect 235 ms 15480 KB Output isn't correct
21 Incorrect 134 ms 13180 KB Output isn't correct
22 Incorrect 118 ms 12536 KB Output isn't correct
23 Incorrect 127 ms 13048 KB Output isn't correct
24 Incorrect 139 ms 13048 KB Output isn't correct
25 Incorrect 137 ms 12920 KB Output isn't correct
26 Incorrect 122 ms 12536 KB Output isn't correct
27 Incorrect 147 ms 13176 KB Output isn't correct
28 Incorrect 191 ms 13176 KB Output isn't correct
29 Incorrect 235 ms 13944 KB Output isn't correct
30 Incorrect 253 ms 16120 KB Output isn't correct
31 Incorrect 173 ms 14200 KB Output isn't correct
32 Incorrect 156 ms 13048 KB Output isn't correct
33 Incorrect 146 ms 13304 KB Output isn't correct
34 Incorrect 175 ms 13688 KB Output isn't correct
35 Incorrect 140 ms 13304 KB Output isn't correct
36 Incorrect 138 ms 13560 KB Output isn't correct
37 Incorrect 195 ms 14304 KB Output isn't correct
38 Incorrect 213 ms 14200 KB Output isn't correct
39 Incorrect 202 ms 14300 KB Output isn't correct
40 Incorrect 252 ms 15736 KB Output isn't correct
41 Incorrect 380 ms 18040 KB Output isn't correct