Submission #546785

#TimeUsernameProblemLanguageResultExecution timeMemory
546785brunnorezendesStations (IOI20_stations)C++17
0 / 100
738 ms548 KiB
#include "stations.h" #include <bits/stdc++.h> #define maxn 1006 using namespace std; typedef vector <int> vi; int cont; int resp[maxn]; vi g[maxn]; void dfs(int x, int pai){ int i; for(i=0;i<g[x].size();i++){ if(g[x][i]!=pai){ dfs(g[x][i], x); } } resp[x] = cont++; } vi label(int n, int k, vi u, vi v){ for(int i=0;i<n;i++){ g[i].clear(); } vi labels = vi(n); for(int i=0;i<u.size();i++){ g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } cont=0; dfs(0, 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 i; for(i=0;i<c.size();i++){ if(t<=c[i]) return c[i]; } return c[c.size()-1]; }

Compilation message (stderr)

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:15:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for(i=0;i<g[x].size();i++){
      |          ~^~~~~~~~~~~~
stations.cpp: In function 'vi label(int, int, vi, vi)':
stations.cpp:28:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |  for(int i=0;i<u.size();i++){
      |              ~^~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, vi)':
stations.cpp:40:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |  for(i=0;i<c.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...