Submission #28872

#TimeUsernameProblemLanguageResultExecution timeMemory
28872kavunRace (IOI11_race)C++14
0 / 100
9 ms7416 KiB
#include "race.h" #include <bits/stdc++.h> using namespace std; vector <pair<int,int> > adj[300000]; void dfs(int v, int d, int length, int par, int& mn, int K) { if(length == K) { mn = min(mn,d); } else if(length > K) return; for(int i = 0; i < adj[v].size(); i++) { int u = adj[v][i].first; if(u != par) dfs(u,d+1,length + adj[v][i].second,v,mn, K); } } int best_path(int N, int K, int H[][2], int L[]) { for(int i = 0; i < N-1; i++) { int v = H[i][0],u = H[i][1],l = L[i]; adj[v].push_back(make_pair(u,l)); adj[u].push_back(make_pair(v,l)); } int mn = 1e9; for(int i = 0; i < N; i++) { dfs(i,0,0,i,mn,K); } return N; }

Compilation message (stderr)

race.cpp: In function 'void dfs(int, int, int, int, int&, int)':
race.cpp:16:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < adj[v].size(); i++)
                    ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...