# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
983772 | 2024-05-16T05:29:44 Z | Amaarsaa | Bitaro’s Party (JOI18_bitaro) | C++14 | 1 ms | 3420 KB |
#include<bits/stdc++.h> using namespace std; using ll = long long ; vector < ll > adj[100004]; int main() { // freopen("moocast.in", "r", stdin); // freopen("moocast.out", "w", stdout); ios::sync_with_stdio(false); cin.tie(NULL); ll t, n, m, ans, s, sum, x, y, r, p, i, j, Q; cin >> n >> m >> Q; for ( i = 1; i <= m; i ++) { cin >> x >> y; adj[y].push_back(x); } ll d[100004]; for (i = 1; i <= n; i ++) d[i] = 0; queue < ll > q; cin >> x; ll xx = x; q.push(x); d[x] = 0; while(!q.empty()) { x = q.front(); q.pop(); for ( ll X : adj[x]) { if ( d[X] < d[x] + 1) { d[X]= d[x] + 1; q.push(X); } } } cin >> m; for (i = 1; i <= m; i ++) { cin >> x; d[x]= -1; } ans = -1; for (i = 1; i <= n; i ++) { ans = max(ans, d[i]); } cout << ans << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 3420 KB | Output is correct |
2 | Correct | 1 ms | 3420 KB | Output is correct |
3 | Correct | 1 ms | 3420 KB | Output is correct |
4 | Incorrect | 1 ms | 3420 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 3420 KB | Output is correct |
2 | Correct | 1 ms | 3420 KB | Output is correct |
3 | Correct | 1 ms | 3420 KB | Output is correct |
4 | Incorrect | 1 ms | 3420 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 3420 KB | Output is correct |
2 | Correct | 1 ms | 3420 KB | Output is correct |
3 | Correct | 1 ms | 3420 KB | Output is correct |
4 | Incorrect | 1 ms | 3420 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |