Submission #580917

#TimeUsernameProblemLanguageResultExecution timeMemory
580917JomnoiStations (IOI20_stations)C++17
0 / 100
3073 ms2097152 KiB
#include <bits/stdc++.h> #include "stations.h" using namespace std; const int MAX_N = 1005; int timer; vector <int> graph[MAX_N]; int st[MAX_N], en[MAX_N]; void dfs(int u, int p) { st[u] = timer++; for(auto v : graph[u]) { if(v != p) { dfs(v, u); } } en[u] = timer - 1; } vector <int> label(int n, int k, vector <int> u, vector <int> v) { for(int i = 0; i < n - 1; i++) { graph[u[i]].push_back(v[i]); graph[v[i]].push_back(u[i]); } dfs(0, -1); vector <int> labels(n); for(int i = 0; i < n; i++) { labels[i] = st[i] * 1000 + en[i]; } return labels; } int find_next_station(int s, int t, vector <int> c) { int stS = s / 1000, enS = s % 1000; int stT = t / 1000, enT = t % 1000; for(int i = 1; i < c.size(); i++) { int stC = c[i] / 1000, enC = c[i] % 1000; if(stC < stT and enT < enC) { return c[i]; } } return c[0]; }

Compilation message (stderr)

stations.cpp: In function 'int find_next_station(int, int, std::vector<int>)':
stations.cpp:39:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for(int i = 1; i < c.size(); i++) {
      |                 ~~^~~~~~~~~~
stations.cpp:37:6: warning: unused variable 'stS' [-Wunused-variable]
   37 |  int stS = s / 1000, enS = s % 1000;
      |      ^~~
stations.cpp:37:22: warning: unused variable 'enS' [-Wunused-variable]
   37 |  int stS = s / 1000, enS = s % 1000;
      |                      ^~~
#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...