Submission #546764

#TimeUsernameProblemLanguageResultExecution timeMemory
546764brunnorezendesStations (IOI20_stations)C++14
0 / 100
7 ms772 KiB
#include "stations.h" #include <bits/stdc++.h> #define maxn 1001 using namespace std; typedef vector <int> vi; typedef vector <vi> vvi; typedef pair <vi, int> vii; vii dfs(int n, int x, vvi g, int pai, vi resp, int cont){ int i; vii d; for(i=0;i<g[x].size();i++){ if(g[x][i]!=pai){ d = dfs(n, g[x][i], g, x, resp, cont); resp = d.first; cont = d.second; } } resp[x] = cont++; return {resp, cont}; } vi label(int n, int k, vi u, vi v){ vvi g = vvi(n); vii retur; vi resp = vi(n, 0); for(int i=0;i<n-1;i++){ g[u[i]].push_back(v[i]); } retur = dfs(n, 0, g, 0, resp, 0); return retur.first; } int find_next_station(int s, int t, vi c){ int l=0, r=c.size()-1, mid; while(r>l){ mid = (l+r)/2; if(t<=c[mid]){ r = mid; } else l = mid+1; } return c[l]; }

Compilation message (stderr)

stations.cpp: In function 'vii dfs(int, int, vvi, int, vi, int)':
stations.cpp:14:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |  for(i=0;i<g[x].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...
#Verdict Execution timeMemoryGrader output
Fetching results...