Submission #806860

#TimeUsernameProblemLanguageResultExecution timeMemory
806860borisAngelovStations (IOI20_stations)C++17
0 / 100
3062 ms2097152 KiB
#include "stations.h" #include <bits/stdc++.h> using namespace std; const int maxn = 1005; vector<int> g[maxn]; int tim = 0; vector<int> hashed; void dfs(int node, int par) { hashed[node] = tim * 1000; ++tim; for (int i = 0; i < g[node].size(); ++i) { if (g[node][i] != par) { dfs(g[node][i], node); } } hashed[node] += (tim - 1); } vector<int> label(int n, int k, vector<int> u, vector<int> v) { for (int i = 0; i < u.size(); ++i) { int x = u[i]; int y = v[i]; g[x].push_back(y); g[y].push_back(x); } hashed.resize(n); dfs(0, -1); return hashed; } int find_next_station(int s, int t, vector<int> c) { int in_s = s / 1000; int out_s = s % 1000; int in_t = t / 1000; int out_t = t % 1000; if (in_s <= in_t && out_t <= out_s) { int from = (in_s == 0 ? 0 : 1); for (int i = from; i < c.size(); ++i) { int in_i = c[i] / 1000; int out_i = c[i] % 1000; if (in_i <= in_t && out_t <= out_i) { return c[i]; } } } return c[0]; }

Compilation message (stderr)

stations.cpp: In function 'void dfs(int, int)':
stations.cpp:19:23: 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 < g[node].size(); ++i)
      |                     ~~^~~~~~~~~~~~~~~~
stations.cpp: In function 'std::vector<int> label(int, int, std::vector<int>, std::vector<int>)':
stations.cpp:32:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |     for (int i = 0; i < u.size(); ++i)
      |                     ~~^~~~~~~~~~
stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:59:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   59 |         for (int i = from; 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...