Submission #780765

#TimeUsernameProblemLanguageResultExecution timeMemory
780765JosiaStations (IOI20_stations)C++17
0 / 100
800 ms672 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; vector<int> pre; vector<vector<int>> graph; int tim; void dfs(int v) { if (pre[v] != -1) return; pre[v] = tim++; for (int i: graph[v]) { dfs(i); } } vector<int> label(int n, int k, vector<int> u, vector<int> v) { tim = 0; vector<int> labels(n); pre.assign(n, -1); graph.clear(); graph.resize(n); for (int i = 0; i<n-1; i++) { graph[u[i]].push_back(v[i]); graph[v[i]].push_back(u[i]); } dfs(0); // for (int i: pre) cerr << i << " "; // cerr << "\n"; return pre; } int find_next_station(int s, int t, vector<int> c) { sort(c.begin(), c.end()); if (t < s) return c[0]; reverse(c.begin(), c.end()); for (int i = 0; i<c.size(); i++) { if (t >= c[i]) return c[i]; } return -1; assert(0); }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:49:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |  for (int 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...