# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
32264 | dqhungdl | Bosses (BOI16_bosses) | C++14 | 653 ms | 2464 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n,res=1e9,h[5005],Q[5005];
vector<int> g[5005];
void BFS(int u)
{
for(int i=1;i<=n;i++)
h[i]=0;
h[u]=1;
Q[1]=u;
int l=1,r=1;
while(l<=r)
{
int u=Q[l++];
for(int i=0;i<g[u].size();i++)
if(h[g[u][i]]==0)
{
Q[++r]=g[u][i];
h[g[u][i]]=h[u]+1;
}
}
if(r==n)
{
int sum=0;
for(int i=1;i<=n;i++)
sum+=h[i];
res=min(res,sum);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |