Submission #91978

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
919782018-12-31 17:52:12KamisamaBosses (BOI16_bosses)C++14
0 / 100
2 ms504 KiB
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;
const int maxn=5e3+7;
int n,h[maxn],res;
vector<int> adj[maxn];
inline void Bfs(const int &root){
queue<int> q;
fill(h,h+n+1,0);
h[root]=1;
int sum=1,nEdges=0;
q.push(root);
while(q.size()){
int u=q.front();
q.pop();
for(int v: adj[u]){
if(h[v]) continue;
nEdges++;
h[v]=h[u]+1;
sum+=h[v];
q.push(v);
}
}
if(nEdges==n-1)res=min(res,sum);
}
inline void Read(int &x){
register char c;
for(c=getchar();c>'9'||c<'0';c=getchar());
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

bosses.cpp: In function 'int main()':
bosses.cpp:43:17: warning: unused variable 'res' [-Wunused-variable]
     for(int i=1,res=(int)1e9+7;i<=n;i++) Bfs(i);
                 ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...