제출 #860861

#제출 시각아이디문제언어결과실행 시간메모리
860861elotelo966Bosses (BOI16_bosses)C++17
67 / 100
1504 ms4496 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define int long long #define OYY 1000000005 #define mod 1000000007 #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define mid (start+end)/2 #define lim 100005 vector<int> v[lim]; int dis[lim],n,vis[lim]; inline int bfs(int node){ for (int i=1;i<=n;i++){ dis[i]=OYY; vis[i]=0; } priority_queue <pair<int,int>> pq; pq.push({1,node}); dis[node]=1; vis[node]=1; //cout<<node<<" "<<dis[node]<<endl; while(!pq.empty()){ int nd=pq.top().second; pq.pop(); // cout<<pq.top().first<<" "<<pq.top().second<<" "<<dis[nd]<<endl; for(int i=0;i<v[nd].size();i++){ if(vis[v[nd][i]])continue; dis[v[nd][i]]=min(dis[v[nd][i]],dis[nd]+1); vis[v[nd][i]]=1; pq.push({-dis[v[nd][i]],v[nd][i]}); } } int cev=0; for(int i=1;i<=n;i++){ cev+=dis[i]; } // cout<<cev<<endl; return cev; } int32_t main(){ faster cin>>n; for(int i=1;i<=n;i++){ int deg,tut;cin>>deg; for(int j=0;j<deg;j++){ cin>>tut; v[tut].push_back(i); } } int cev=OYY; for(int i=1;i<=n;i++){ cev=min(cev,bfs(i)); } cout<<cev<<'\n'; return 0; }

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

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