제출 #969791

#제출 시각아이디문제언어결과실행 시간메모리
969791vjudge1Bosses (BOI16_bosses)C++14
100 / 100
499 ms848 KiB
#include <bits/stdc++.h> using namespace std; int n,a,b,mn=INT_MAX; vector<int> v[5005]; bool visited[5005]; queue<pair<int,int>> q; int main() { cin.tie(0)->sync_with_stdio(0); cin >> n; for(int i=1;i<=n;i++){ cin >> a; for(int j=0;j<a;j++) cin >> b,v[b].push_back(i); } for(int i=1;i<=n;i++){ q.push({1,i}); int sum=0,cnt=0; memset(visited,0,sizeof(visited)); while(!q.empty()){ int now=q.front().second,cost=q.front().first; q.pop(); if(visited[now]) continue; visited[now]=1; sum+=cost; cnt++; for(auto e:v[now]) if(!visited[e]) q.push({cost+1,e}); } if(cnt==n) mn=min(mn,sum); } cout << mn; return 0; }

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

bosses.cpp: In function 'int main()':
bosses.cpp:22:13: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   22 |             if(visited[now]) continue; visited[now]=1;
      |             ^~
bosses.cpp:22:40: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   22 |             if(visited[now]) continue; visited[now]=1;
      |                                        ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...