제출 #991772

#제출 시각아이디문제언어결과실행 시간메모리
991772simona1230Bitaro’s Party (JOI18_bitaro)C++17
0 / 100
1 ms3160 KiB
#include <bits/stdc++.h> using namespace std; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int n,m,q; vector<int> v[100001]; void read() { cin>>n>>m>>q; for(int i=1;i<=m;i++) { int x,y; cin>>x>>y; v[x].push_back(y); } } int dp[100001]; int vert,idx,ans; int used[100001]; void dfs(int i) { //cout<<i<<endl; if(i==vert) { ans=0; dp[i]=0; return; } for(int j=0;j<v[i].size();j++) { int nb=v[i][j]; if(vert<nb)continue; if(dp[nb]==-1) dfs(nb); if(dp[nb]!=-1) dp[i]=max(dp[i],dp[nb]+1); } if(used[i]!=idx) ans=max(ans,dp[i]); } void solve() { for(int i=1;i<=q;i++) { for(int j=1;j<=n;j++) dp[j]=-1; idx=i; int k,b; cin>>vert>>k; for(int j=1;j<=k;j++) { cin>>b; used[b]=i; } ans=-1; dfs(1); cout<<ans<<endl; } } int main() { speed(); read(); solve(); return 0; }

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

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