Submission #426494

#TimeUsernameProblemLanguageResultExecution timeMemory
426494tengiz05Bitaro’s Party (JOI18_bitaro)C++17
14 / 100
2078 ms12804 KiB
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, m, q; std::cin >> n >> m >> q; std::vector<std::vector<int>> e(n), p(n); for (int i = 0; i < m; i++) { int u, v; std::cin >> u >> v; u--; v--; e[u].push_back(v); p[v].push_back(u); } while (q--) { int t, k; std::cin >> t >> k; t--; std::vector<int> dp(n); std::vector<bool> bad(n); for (int i = 0, x; i < k; i++) { std::cin >> x; bad[--x] = true; dp[x] = -1000000; } for (int u = 0; u < n; u++) { for (auto v : p[u]) { dp[u] = std::max(dp[u], dp[v] + 1); } } int ans = -1; std::cout << std::max(-1, dp[t]) << "\n"; } return 0; }

Compilation message (stderr)

bitaro.cpp: In function 'int main()':
bitaro.cpp:32:13: warning: unused variable 'ans' [-Wunused-variable]
   32 |         int ans = -1;
      |             ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...