Submission #567315

#TimeUsernameProblemLanguageResultExecution timeMemory
567315katwamiawBitaro’s Party (JOI18_bitaro)C++14
0 / 100
2089 ms2656 KiB
#include<bits/stdc++.h> #define ll long long #define no cout << "NO\n" #define yes cout << "YES\n" #define endl '\n' #define pb push_back using namespace std ; //fflush(stdout) ; const int Max_n=1e5+10 ; vector<int>v[Max_n] ; set<int>s ; int ans=0 ; void dfs(int x , int r){ if(s.count(x)==0) ans=max(ans,r) ; for(int i:v[x]){ dfs(i,r+1) ; } } int main(){ int n , m , q ; cin >> n >> m >> q ; for(int i=0 ; i<m ; i++){ int a , e ; cin >> a >> e ; v[max(a,e)].pb(min(a,e)) ; } while(q--){ int t , y ; cin >> t >> y ; s.clear() ; for(int i=0 ; i<y ; i++){ int a ; cin >> a ; s.insert(a) ; } ans=-1 ; dfs(t , 0) ; cout << ans << endl ; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...