# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
110765 |
2019-05-12T08:00:02 Z |
MAMBA |
007 (CEOI14_007) |
C++17 |
|
40 ms |
23932 KB |
#include <bits/stdc++.h>
using namespace std;
#define rep(i , j , k) for (int i = j; i < (int)k; i++)
#define pb push_back
#define mt make_tuple
#define for_all(x) x.begin(),x.end()
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef long double ld;
typedef complex<ld> point;
inline void fileIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
template<class T , class S>
inline bool smin(T &a, S b) { return (T)b < a ? a = b , 1 : 0; }
template<class T , class S>
inline bool smax(T &a, S b) { return a < (T)b ? a = b , 1 : 0; }
constexpr int N = 1e6 + 10;
constexpr int MOD = 1e9 + 7;
template<typename T>
inline T mod(T &v) { return v = (v % MOD + MOD) % MOD; }
template<typename S, typename T>
inline S add(S &l, T r) { return mod(l += r); }
ll po(ll v, ll u) { return u ? po(v * v % MOD , u >> 1) * (u & 1 ? v : 1) % MOD : 1; }
int n , m;
int s , t , a , b, dist[N];
vector<int> adj[N];
int L , R , Q[N];
void bfs(int so) {
memset(dist , -1, sizeof(dist));
dist[so] = 0;
L = 0, R = 1;
Q[0] = so;
while (L < R) {
int me = Q[L++];
for (auto e : adj[me])
if (!~dist[e]) {
dist[e] = dist[me] + 1;
Q[R++] = e;
}
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#ifndef LOCAL
// fileIO("forbidden1");
#endif
cout << -1 << endl;
return 0;
cin >> n >> m >> s >> t >> a >> b;
rep(i , 0 , m) {
int u , v;
cin >> u >> v;
adj[u].pb(v);
adj[v].pb(u);
}
bfs(s);
int A = dist[a];
int B = dist[b];
bfs(t);
int C = dist[a];
int D = dist[b];
int res = min(C - A , D - B);
if (res < 0) res = -1;
cout << res << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
26 ms |
23800 KB |
Partially correct |
2 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
3 |
Partially correct |
27 ms |
23808 KB |
Partially correct |
4 |
Partially correct |
26 ms |
23868 KB |
Partially correct |
5 |
Partially correct |
24 ms |
23808 KB |
Partially correct |
6 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
7 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
8 |
Partially correct |
27 ms |
23808 KB |
Partially correct |
9 |
Incorrect |
30 ms |
23808 KB |
Output isn't correct |
10 |
Incorrect |
26 ms |
23808 KB |
Output isn't correct |
11 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
12 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
13 |
Incorrect |
27 ms |
23808 KB |
Output isn't correct |
14 |
Incorrect |
22 ms |
23808 KB |
Output isn't correct |
15 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
16 |
Incorrect |
24 ms |
23852 KB |
Output isn't correct |
17 |
Incorrect |
23 ms |
23808 KB |
Output isn't correct |
18 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
19 |
Incorrect |
27 ms |
23808 KB |
Output isn't correct |
20 |
Incorrect |
28 ms |
23780 KB |
Output isn't correct |
21 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
22 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
23 |
Incorrect |
30 ms |
23800 KB |
Output isn't correct |
24 |
Partially correct |
24 ms |
23808 KB |
Partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
25 ms |
23860 KB |
Output isn't correct |
2 |
Incorrect |
25 ms |
23800 KB |
Output isn't correct |
3 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
4 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
5 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
6 |
Incorrect |
28 ms |
23808 KB |
Output isn't correct |
7 |
Incorrect |
22 ms |
23808 KB |
Output isn't correct |
8 |
Incorrect |
33 ms |
23804 KB |
Output isn't correct |
9 |
Incorrect |
25 ms |
23932 KB |
Output isn't correct |
10 |
Incorrect |
26 ms |
23808 KB |
Output isn't correct |
11 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
12 |
Incorrect |
31 ms |
23808 KB |
Output isn't correct |
13 |
Incorrect |
28 ms |
23808 KB |
Output isn't correct |
14 |
Correct |
23 ms |
23808 KB |
Output is correct |
15 |
Incorrect |
28 ms |
23800 KB |
Output isn't correct |
16 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
17 |
Incorrect |
27 ms |
23808 KB |
Output isn't correct |
18 |
Incorrect |
23 ms |
23808 KB |
Output isn't correct |
19 |
Incorrect |
28 ms |
23808 KB |
Output isn't correct |
20 |
Incorrect |
26 ms |
23800 KB |
Output isn't correct |
21 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
22 |
Incorrect |
23 ms |
23808 KB |
Output isn't correct |
23 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
24 |
Incorrect |
23 ms |
23804 KB |
Output isn't correct |
25 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
26 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
27 |
Incorrect |
23 ms |
23808 KB |
Output isn't correct |
28 |
Incorrect |
27 ms |
23808 KB |
Output isn't correct |
29 |
Incorrect |
28 ms |
23800 KB |
Output isn't correct |
30 |
Incorrect |
40 ms |
23808 KB |
Output isn't correct |
31 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
32 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
33 |
Incorrect |
28 ms |
23808 KB |
Output isn't correct |
34 |
Incorrect |
23 ms |
23808 KB |
Output isn't correct |
35 |
Incorrect |
30 ms |
23808 KB |
Output isn't correct |
36 |
Incorrect |
29 ms |
23780 KB |
Output isn't correct |
37 |
Incorrect |
25 ms |
23780 KB |
Output isn't correct |
38 |
Incorrect |
25 ms |
23808 KB |
Output isn't correct |
39 |
Incorrect |
24 ms |
23808 KB |
Output isn't correct |
40 |
Incorrect |
25 ms |
23800 KB |
Output isn't correct |
41 |
Incorrect |
27 ms |
23928 KB |
Output isn't correct |