# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
243273 | 2020-06-30T16:42:04 Z | BamiTorabi | 007 (CEOI14_007) | C++14 | 343 ms | 36216 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); if (dist[2][t] < dist[2][s] || dist[3][t] < dist[b][s]) return printf("-1\n"), 0; return printf("-2\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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 18 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Incorrect | 9 ms | 8064 KB | Output isn't correct |
3 | Runtime error | 18 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 18 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 18 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 18 ms | 16512 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 19 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 18 ms | 16280 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 21 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 18 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 20 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 19 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 20 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Incorrect | 9 ms | 8192 KB | Output isn't correct |
15 | Runtime error | 20 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 24 ms | 16340 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 19 ms | 16488 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 19 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
19 | Runtime error | 19 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
20 | Runtime error | 19 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
21 | Runtime error | 18 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
22 | Runtime error | 18 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
23 | Runtime error | 18 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
24 | Runtime error | 20 ms | 16384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 46 ms | 18936 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Runtime error | 70 ms | 20088 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Runtime error | 49 ms | 19064 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
4 | Runtime error | 62 ms | 20216 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Runtime error | 44 ms | 18908 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
6 | Runtime error | 45 ms | 19304 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
7 | Runtime error | 47 ms | 19448 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
8 | Runtime error | 50 ms | 19576 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
9 | Runtime error | 62 ms | 20216 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
10 | Runtime error | 204 ms | 28792 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
11 | Runtime error | 80 ms | 22392 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
12 | Runtime error | 118 ms | 23672 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
13 | Runtime error | 93 ms | 22648 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
14 | Correct | 62 ms | 10744 KB | Output is correct |
15 | Runtime error | 112 ms | 23676 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
16 | Runtime error | 133 ms | 24056 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
17 | Runtime error | 102 ms | 23288 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
18 | Runtime error | 145 ms | 23288 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
19 | Runtime error | 144 ms | 25720 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
20 | Runtime error | 259 ms | 31480 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
21 | Runtime error | 150 ms | 26488 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
22 | Runtime error | 157 ms | 25208 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
23 | Runtime error | 151 ms | 26368 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
24 | Runtime error | 143 ms | 26360 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
25 | Runtime error | 136 ms | 25720 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
26 | Runtime error | 132 ms | 25208 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
27 | Runtime error | 151 ms | 26744 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
28 | Runtime error | 173 ms | 26488 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
29 | Runtime error | 194 ms | 28068 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
30 | Runtime error | 285 ms | 32504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
31 | Runtime error | 171 ms | 28024 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
32 | Runtime error | 161 ms | 26360 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
33 | Runtime error | 162 ms | 26744 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
34 | Runtime error | 180 ms | 27384 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
35 | Runtime error | 153 ms | 26872 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
36 | Runtime error | 157 ms | 27256 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
37 | Runtime error | 199 ms | 28792 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
38 | Runtime error | 187 ms | 28408 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
39 | Runtime error | 212 ms | 28408 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
40 | Runtime error | 255 ms | 31992 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
41 | Runtime error | 343 ms | 36216 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |