Submission #1123654

#TimeUsernameProblemLanguageResultExecution timeMemory
1123654ZeroCoolBitaro’s Party (JOI18_bitaro)C++20
0 / 100
5 ms6464 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]; vector<int> g[N]; void calc(int x){ memset(dp, -1, sizeof dp); dp[x] = 0; for(int i = x;i >= 0;i--){ for(auto u: g[i])dp[u] = max(dp[u], dp[i] + 1); } } int del[N]; 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); } while(q--){ int x, y; cin>>x>>y; --x; calc(x); while(y--){ int t; cin>>t; --t; del[t] = q;; } int ans = -1; for(int i = 0;i < n;i++){ if(del[i] != q){ ans = max(ans, dp[i]); } } cout<<ans<<'\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...