Submission #735882

#TimeUsernameProblemLanguageResultExecution timeMemory
735882tigarCrocodile's Underground City (IOI11_crocodile)C++14
0 / 100
2 ms2644 KiB
#include <bits/stdc++.h> #include "crocodile.h" using namespace std; typedef long long ll; ll INF=LONG_MAX; vector<pair<ll, ll> >graff[100010]; bool izlaz[100010], check[100010]; int T[100010]; void dfs(int v) { if(check[v])return; check[v]=true; if(izlaz[v]){T[v]=0; return;} ll m1=INF, m2=INF; for(int i=0; i<graff[v].size(); i++) { dfs(graff[v][i].first); ll xx=T[graff[v][i].first]+graff[v][i].second; if(xx<m1){m2=m1; m1=xx;} else if(xx>=m1 and xx<=m2){m2=xx;} } T[v]=m2; return; } int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) { for(int i=0; i<m; i++) { graff[r[i][0]].push_back({r[i][1], l[i]}); graff[r[i][1]].push_back({r[i][0], l[i]}); } for(int i=0; i<k; i++)izlaz[p[i]]=true; for(int i=0; i<n; i++)T[i]=INF; dfs(0); return T[0]; }

Compilation message (stderr)

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