Submission #983786

#TimeUsernameProblemLanguageResultExecution timeMemory
983786AmaarsaaBitaro’s Party (JOI18_bitaro)C++14
0 / 100
4 ms5468 KiB
#include<bits/stdc++.h> using namespace std; using ll = long long ; vector < ll > adj[100004]; ll d[100004]= {0}, used[100004], u[100004]; vector < int > ans; void dfs(int x) { used[x] = 1; for ( int X : adj[x]) { if (!used[X]) dfs(X); } ans.push_back(x); } int main() { // freopen("moocast.in", "r", stdin); // freopen("moocast.out", "w", stdout); ios::sync_with_stdio(false); cin.tie(NULL); ll t, n, m, s, sum, x, y, r, p, i, j, Q; cin >> n >> m >> Q; for ( i = 1; i <= m; i ++) { cin >> x >> y; adj[x].push_back(y); } int XX; cin >> XX; for (i = 1; i <= n; i ++) { ans[i -1] = i; } cin >> m; for (i = 1; i <= m; i ++) { cin >> x; u[x] = 1; } for (i = 1; i <= n; i ++) d[i] = -1; for (i = 0; i < n; i ++) { if ( u[ans[i]] == 1 && d[ans[i]] == -1) continue; d[ans[i]] = max(0ll,d[ans[i]]); for (int X : adj[ans[i]]) { d[X] = max(d[X], d[ans[i]] + 1); } } cout << d[XX] << endl; }

Compilation message (stderr)

bitaro.cpp: In function 'int main()':
bitaro.cpp:21:5: warning: unused variable 't' [-Wunused-variable]
   21 |  ll t, n, m, s, sum, x, y, r, p, i, j, Q;
      |     ^
bitaro.cpp:21:14: warning: unused variable 's' [-Wunused-variable]
   21 |  ll t, n, m, s, sum, x, y, r, p, i, j, Q;
      |              ^
bitaro.cpp:21:17: warning: unused variable 'sum' [-Wunused-variable]
   21 |  ll t, n, m, s, sum, x, y, r, p, i, j, Q;
      |                 ^~~
bitaro.cpp:21:28: warning: unused variable 'r' [-Wunused-variable]
   21 |  ll t, n, m, s, sum, x, y, r, p, i, j, Q;
      |                            ^
bitaro.cpp:21:31: warning: unused variable 'p' [-Wunused-variable]
   21 |  ll t, n, m, s, sum, x, y, r, p, i, j, Q;
      |                               ^
bitaro.cpp:21:37: warning: unused variable 'j' [-Wunused-variable]
   21 |  ll t, n, m, s, sum, x, y, r, p, i, j, Q;
      |                                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...