Submission #28842

#TimeUsernameProblemLanguageResultExecution timeMemory
28842inqrRace (IOI11_race)C++14
21 / 100
3053 ms10888 KiB
#include "race.h" #include <bits/stdc++.h> using namespace std; int dfsv[200005]; int ans=INT_MAX; int vern; vector < pair < int , int > > e[200005]; void dfs(int vernow,int roa,int len,int tarlen){ dfsv[vernow]=1; if(len==tarlen){ans=min(ans,roa);return;} if(len>tarlen)return; for(int i=0;i<e[vernow].size();i++){ if(dfsv[e[vernow][i].first]==0){ dfs(e[vernow][i].first,roa+1,len+e[vernow][i].second,tarlen); } } return; } int best_path(int N, int K, int H[][2], int L[]) { vern=N; for(int i=0;i<N-1;i++){ e[H[i][0]].push_back(make_pair(H[i][1],L[i])); e[H[i][1]].push_back(make_pair(H[i][0],L[i])); } for(int i=0;i<N;i++){ memset(dfsv,0,sizeof(dfsv)); dfs(i,0,0,K); } return ans==INT_MAX ? -1 : ans ; }

Compilation message (stderr)

race.cpp: In function 'void dfs(int, int, int, int)':
race.cpp:12:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<e[vernow].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...