Submission #546779

#TimeUsernameProblemLanguageResultExecution timeMemory
546779brunnorezendesStations (IOI20_stations)C++17
0 / 100
6 ms860 KiB
#include "stations.h" #include <bits/stdc++.h> #define maxn 1006 using namespace std; typedef vector <int> vi; typedef vector <vi> vvi; typedef pair <vi, int> vii; int cont; int resp[maxn]; void dfs(int x, vvi g, int pai){ int i; for(i=0;i<g[x].size();i++){ if(g[x][i]!=pai){ dfs(g[x][i], g, x); } } resp[x] = cont++; } vi label(int n, int k, vi u, vi v){ vvi g = vvi(n); vi labels = vi(n); for(int i=0;i<u.size();i++){ g[u[i]].push_back(v[i]); } cont=0; dfs(0, g, 0); for(int i=0;i<n;i++) labels[i] = resp[i]; return labels; } 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 'void dfs(int, vvi, int)':
stations.cpp:16:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  for(i=0;i<g[x].size();i++){
      |          ~^~~~~~~~~~~~
stations.cpp: In function 'vi label(int, int, vi, vi)':
stations.cpp:27:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for(int i=0;i<u.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...