제출 #77034

#제출 시각아이디문제언어결과실행 시간메모리
77034farukkastamonudaBosses (BOI16_bosses)C++14
100 / 100
739 ms1556 KiB
#include <bits/stdc++.h> #define li 10005 #define lo long long #define inf 1000000000000000000 using namespace std ; lo int n,x,y,mark[li],cnt,ans=inf,val; vector<lo int> v[li]; int main(){ scanf("%lld",&n); for(int i=1;i<=n;i++){ scanf("%lld",&x); for(int j=1;j<=x;j++){ scanf("%lld",&y); v[y].push_back(i); } } lo int cev=0; for(int i=1;i<=n;i++){ cev=0; val=0; memset(mark,0,sizeof(mark)); queue<int> q; q.push(i); cnt=0; mark[i]=1; while(!q.empty()){ int vv=q.front(); q.pop(); cnt++; val+=mark[vv]; if(val>=ans) break; for(int j=0;j<(int)v[vv].size();j++){ int go=v[vv][j]; if(mark[go]) continue; mark[go]=mark[vv]+1; q.push(go); } } if(cnt==n) ans=min(ans,val); } printf("%lld\n",ans); return 0; }

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

bosses.cpp: In function 'int main()':
bosses.cpp:17:12: warning: variable 'cev' set but not used [-Wunused-but-set-variable]
     lo int cev=0;
            ^~~
bosses.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld",&n);
     ~~~~~^~~~~~~~~~~
bosses.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&x);
         ~~~~~^~~~~~~~~~~
bosses.cpp:13:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%lld",&y);
             ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...