Submission #1031040

#TimeUsernameProblemLanguageResultExecution timeMemory
1031040belgianbotBitaro’s Party (JOI18_bitaro)C++14
0 / 100
1 ms2396 KiB
#include <bits/stdc++.h> using namespace std; int N, M, Q; vector<vector<int>> adj; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cin >> N >> M >> Q; adj.resize(N); for (int i = 0; i < M; i++) { int a, b; cin >> a >> b; a--; b--; adj[b].push_back(a); } vector<vector<int>> sol(N); for (int i = 0; i < N; i++) { sol[i].resize(i + 1, INT_MIN); sol[i][i] = 0; for (int j : adj[i]) { sol[i][j] = 1; for (int k = 0; k < sol[j].size(); k++) { sol[i][k] = max(sol[i][k], sol[j][k] + 1); } } } while (Q--) { int T, Y; cin >> T >> Y; T--; vector<bool> busy(N, false); for (int i = 0; i < Y; i++) { int a; cin >> a; a--; busy[a] = true; } int ans = -1; for (int i = 0; i <= T; i++) { if (!busy[i]) { ans = max(ans, sol[T][i]); } } cout << ans << '\n'; } return 0; }

Compilation message (stderr)

bitaro.cpp: In function 'int main()':
bitaro.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |    for (int k = 0; k < sol[j].size(); k++) {
      |                    ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...