Submission #426021

#TimeUsernameProblemLanguageResultExecution timeMemory
426021oscar1fRace (IOI11_race)C++17
0 / 100
1 ms716 KiB
#include "race.h" #include<bits/stdc++.h> using namespace std; const int TAILLE_MAX=1000; int deb; vector<pair<int,int>> adja[TAILLE_MAX]; int dist[TAILLE_MAX][TAILLE_MAX][2]; void DFS(int pos,int distKm,int distArete) { if (dist[deb][pos][0]==-1) { dist[deb][pos][0]=distKm; dist[deb][pos][1]=distArete; for (int ivois=0;ivois<adja[pos].size();ivois++) { DFS(adja[pos][ivois].first,distKm+adja[pos][ivois].second,distArete+1); } } } int best_path(int N, int K, int H[][2], int L[]) { int record=-1; for (int i=0;i<N-1;i++) { adja[H[i][0]].push_back(make_pair(H[i][1],L[i])); adja[H[i][1]].push_back(make_pair(H[i][0],L[i])); } for (int i=0;i<N;i++) { for (int j=0;j<N;j++) { dist[i][j][0]=-1; } } for (int i=0;i<N;i++) { deb=i; DFS(i,0,0); } for (int i=0;i<N;i++) { for (int j=0;j<N;j++) { if (dist[i][j][0]==K) { record=min(record,dist[i][j][1]); } } } return record; }

Compilation message (stderr)

race.cpp: In function 'void DFS(int, int, int)':
race.cpp:14:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (int ivois=0;ivois<adja[pos].size();ivois++) {
      |                      ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...