# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
98958 | zicon35 | Bosses (BOI16_bosses) | C++14 | 2 ms | 384 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,k,v;
vector< vector<int>> adj;
int ans=1e9;
map<int,int> vis;
set<int> seen;
void dfs(int u,int d,int & sum,int n){
if(vis[u]){
return;
}
//cout<<"u: "<<u<<d<<sum<<endl;
vis[u] = 1;
seen.insert(u);
for(int i=0;i<adj[u].size();i++){
int to = adj[u][i];
if(!vis[to]){
sum += d;
//cout<<"test"<<endl;
dfs(to,d+1,sum,n);
}
}
if(seen.size()==n){
//cout<<"here"<<sum+d<<endl;
ans = min(ans,sum+d);
seen.clear();
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... |