Submission #1123659

#TimeUsernameProblemLanguageResultExecution timeMemory
1123659ZeroCoolBitaro’s Party (JOI18_bitaro)C++20
0 / 100
4 ms5192 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ar array #define ld long double const int INF = 1e18 + 10; const int N = 2e5 + 20; const int SQRT = 400; int n, m, q; int dp[N]; bool del[N]; vector<int> g[N]; int depe(int x){ for(int i = 0;i <= x;i++){ dp[i] = del[i] ? -1 : 0; for(auto u: g[i])dp[i] = max(dp[i], dp[u] + 1); } return dp[x]; } signed main(){ios_base::sync_with_stdio(false);cin.tie(0); cin>>n>>m>>q; while(m--){ int a, b; cin>>a>>b; --a, --b; g[b].push_back(a); } for(int it = 1;it <= q;it++){ int x, y; cin>>x>>y; --x; memset(del, 0, sizeof del); while(y--){ int t; cin>>t; --t; del[t] = 1; } cout<<depe(x)<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...