제출 #420408

#제출 시각아이디문제언어결과실행 시간메모리
420408ACmachineBitaro’s Party (JOI18_bitaro)C++17
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> using namespace std; #define FOR(i, j, k, l) for(int i = (j); i < (k); i += (l)) #define FORD(i, j, k, l) for(int i = (j); i >= (k); i-=(l)) #define REP(i, n) FOR(i, 0, n, 1) #define REPD(i, n) FORD(i, n, 0, 1) #define pb push_back int main(){ int n, m, q; cin >> n >> m >> q; vector<vector<int>> g(n); REP(i, m){ int s, e; cin >> s >> e; s--; e--; g[s].pb(e); } REP(i, q){ int t, y; cin >> t >> y; t--; vector<int> dp(n, -(int)1e9); vector<bool> ign(n, false); dp[t] = 0; REPD(v, t - 1){ for(int x : g[v]){ dp[v] = max(dp[v], dp[x] + 1); } } REP(j, y){ int x; cin >> x; x--; ign[x] = true; } int ans = 0; REP(j, n){ if(!ign[j]) ans = max(ans, dp[j]); } cout << ans << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...