Submission #780967

#TimeUsernameProblemLanguageResultExecution timeMemory
780967BlagojStations (IOI20_stations)C++17
0 / 100
781 ms656 KiB
#include <bits/stdc++.h> #include "stations.h" using namespace std; vector<int> g[1005]; int in[1005], out[1005], parent[1005], timer = 0; void dfs(int n, int p) { in[n] = timer++; parent[n] = p; for (auto x : g[n]) if (x != p) dfs(x, n); out[n] = timer++; } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for (int i = 0; i < n; i++) g[i].clear(); timer = 0; for (int i = 0; i < u.size(); i++) { g[u[i]].push_back(v[i]); g[v[i]].push_back(u[i]); } dfs(0, -1); vector<int> labels(n); for (int i = 0; i < n; i++) labels[i] = i; return labels; } int find_next_station(int s, int t, vector<int> c) { for (auto x : c) { if (x == parent[s]) continue; if (in[x] < in[t] && in[t] < out[x]) return x; } return parent[s]; }

Compilation message (stderr)

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