# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1073722 | 2024-08-24T19:19:23 Z | allin27x | Stations (IOI20_stations) | C++17 | 1 ms | 344 KB |
#include <bits/stdc++.h> using namespace std; #include "stations.h" #include <vector> const int N = 1001; vector<int> adj[N]; int tin[N]; int tout[N]; int tp = 0; void dfs(int i, int p) { tin[i] = tp++; for (int c: adj[i]) { if (c == p) continue; dfs(c,i); } tout[i] = tp; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { for (int i=0; i<n; i++) adj[i].clear(); std::vector<int> labels(n); for (int i=0; i<n-1; i++) { adj[u[i]].push_back(v[i]); adj[v[i]].push_back(u[i]); } tp = 0; dfs(0,0); for (int i=0; i<n; i++) labels[i] = 1000*tin[i] + tout[i]; for (int i=0; i<n; i++) cout<<tin[i]<<' '<<tout[i]<<'\n'; return labels; } int find_next_station(int s, int t, std::vector<int> c) { int s_in = s/1000; int s_out = s%1000; int t_in = t/1000; int t_out = t%1000; if (s_in <= t_in && t_out <= s_out) { // t is below s for (int x: c) { int x_in = x/1000; int x_out = x%1000; if (x_in <= t_in && t_out <= x_out) return x; } } else { for (int x: c) { if (x/1000 < s_in) return x; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 344 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 344 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 344 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 344 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 344 KB | Execution killed with signal 13 |
2 | Halted | 0 ms | 0 KB | - |