Submission #98958

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
989582019-02-27 18:50:33zicon35Bosses (BOI16_bosses)C++14
0 / 100
2 ms384 KiB
#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();
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

bosses.cpp: In function 'void dfs(int, int, int&, int)':
bosses.cpp:18:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<adj[u].size();i++){
                 ~^~~~~~~~~~~~~~
bosses.cpp:27:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(seen.size()==n){
        ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...