Submission #308459

#TimeUsernameProblemLanguageResultExecution timeMemory
308459kylych03Crocodile's Underground City (IOI11_crocodile)C++14
46 / 100
214 ms262148 KiB
#include "crocodile.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; vector <pair <int, int > > g[1002]; int vis[1002], vis1[1001]; int dfs(int v, int p ){ vector <int> vec; if(vis[v]) return 0; for(int i = 0 ; i<g[v].size() ; i++){ int to = g[v][i].first; if(to==p) continue; vec.push_back ( dfs(to, v) + g[v][i].second); } sort(vec.begin(), vec.end()); return vec[1]; } int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i = 0 ; i < M ;i++){ g[R[i][0]].push_back(make_pair (R[i][1], L[i]) ); g[R[i][1]].push_back( make_pair (R[i][0], L[i])); } for(int i = 0; i < K; i++) vis[P[i]] = 1; int x = dfs(0, -1); return x; } /* 5 4 3 0 1 2 0 2 3 3 2 1 2 4 4 1 3 4 */

Compilation message (stderr)

crocodile.cpp: In function 'int dfs(int, int)':
crocodile.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i  = 0 ; i<g[v].size() ; i++){
      |                      ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...