제출 #200807

#제출 시각아이디문제언어결과실행 시간메모리
200807ekremBitaro’s Party (JOI18_bitaro)C++98
0 / 100
7 ms2680 KiB
#include<iostream> #include<vector> #include<queue> using namespace::std; vector<int> v[100005]; int ar[100005]; int main(){ int n,m,q; cin>>n>>m>>q; for(int i=0,l,r;i<m;i++) cin>>l>>r,v[r].push_back(l); while(q--){ int x,k,maxn=0; cin>>x>>k; for(int i=0,t;i<k;i++) cin>>t,ar[t]=1; queue<pair<int,int>> q; q.push({x,0}); while(!q.empty()){ int i=q.front().first,w=q.front().second; q.pop(); if(!ar[i]) maxn=max(maxn,w); for(auto a:v[i]) q.push({a,w+1}); } cout<<maxn<<'\n'; for(int i=1;i<=n;i++) ar[i]=0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...