제출 #992188

#제출 시각아이디문제언어결과실행 시간메모리
992188vivkostovBitaro’s Party (JOI18_bitaro)C++14
0 / 100
10 ms25692 KiB
#include<bits/stdc++.h> #define endl "\n" using namespace std; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n,m,qu,a,b,x[200005],y[200005],used[200005],br[200005]; vector<int>v[200005],c[200005]; void bfs(int beg) { used[beg]=1; int w,nb; queue<int>q; q.push(beg); //cout<<beg<<endl; while(!q.empty()) { w=q.front(); q.pop(); if(br[w])br[w]--; if(br[w])continue; //cout<<w<<" "<<beg<<endl; for(int i=0;i<v[w].size();i++) { nb=v[w][i]; q.push(nb); used[nb]=used[w]+1; br[nb]++; } } } void read() { cin>>n>>m>>qu; for(int i=1;i<=m;i++) { cin>>a>>b; v[b].push_back(a); } for(int i=1;i<=qu;i++) { cin>>x[i]>>y[i]; for(int j=1;j<=y[i];j++) { int h; cin>>h; c[i].push_back(h); } bfs(x[i]); int ma=0,num=0; for(int j=1;j<=n;j++) { //cout<<used[j]<<" "<<j<<endl; if(j!=c[i][num])ma=max(ma,used[j]-1); else num++; used[j]=0; br[j]=0; } cout<<ma<<endl; } } int main() { speed(); read(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

bitaro.cpp: In function 'void bfs(int)':
bitaro.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int i=0;i<v[w].size();i++)
      |                     ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...