# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
336026 | 2020-12-14T13:48:03 Z | richyrich | Stations (IOI20_stations) | C++17 | 1067 ms | 1440 KB |
#include "stations.h" #include <vector> #include <bits/stdc++.h> using namespace std; const int N = 1e4+3; const int inf = 1e9; int ans[N], timer; vector<vector<int>> adj(N); void dfs(int x, int par) { for(int y : adj[x]) { if(y==par) continue; dfs(y, x); } ans[x] = timer++; return; } std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) { timer = 0; for(int i = 0; i < n; i++) { adj[i].clear(); ans[i] = 0; } for(int i = 0; i < u.size(); i++) { adj[u[i]].push_back(v[i]), adj[v[i]].push_back(u[i]); } for(int i = 0; i < n; i++) { if(adj[i].size()==1) { dfs(i, -1); break; } } std::vector<int> labels(n); for(int i = 0; i < n; i++) labels[i] = ans[i]; return labels; } int find_next_station(int s, int t, std::vector<int> c) { int n = c.size(); if(s > t) return c[0]; else return c[n-1]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 728 ms | 1376 KB | Output is correct |
2 | Correct | 435 ms | 1272 KB | Output is correct |
3 | Correct | 866 ms | 1120 KB | Output is correct |
4 | Correct | 620 ms | 1248 KB | Output is correct |
5 | Correct | 601 ms | 1120 KB | Output is correct |
6 | Correct | 534 ms | 1248 KB | Output is correct |
7 | Correct | 542 ms | 1312 KB | Output is correct |
8 | Correct | 3 ms | 1120 KB | Output is correct |
9 | Correct | 5 ms | 1120 KB | Output is correct |
10 | Correct | 2 ms | 1120 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 506 ms | 1440 KB | Wrong query response. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 538 ms | 1248 KB | Output is correct |
2 | Correct | 468 ms | 1248 KB | Output is correct |
3 | Correct | 989 ms | 1120 KB | Output is correct |
4 | Correct | 640 ms | 1248 KB | Output is correct |
5 | Correct | 769 ms | 1120 KB | Output is correct |
6 | Correct | 547 ms | 1296 KB | Output is correct |
7 | Correct | 544 ms | 1292 KB | Output is correct |
8 | Correct | 3 ms | 1120 KB | Output is correct |
9 | Correct | 5 ms | 1120 KB | Output is correct |
10 | Correct | 2 ms | 1120 KB | Output is correct |
11 | Incorrect | 621 ms | 1120 KB | Wrong query response. |
12 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1067 ms | 1184 KB | Output is correct |
2 | Correct | 793 ms | 1248 KB | Output is correct |
3 | Correct | 764 ms | 1120 KB | Output is correct |
4 | Correct | 3 ms | 1120 KB | Output is correct |
5 | Correct | 4 ms | 1128 KB | Output is correct |
6 | Correct | 2 ms | 1160 KB | Output is correct |
7 | Incorrect | 601 ms | 1120 KB | Wrong query response. |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 705 ms | 1248 KB | Output is correct |
2 | Correct | 535 ms | 1376 KB | Output is correct |
3 | Correct | 1017 ms | 1120 KB | Output is correct |
4 | Correct | 724 ms | 1128 KB | Output is correct |
5 | Correct | 648 ms | 1312 KB | Output is correct |
6 | Correct | 506 ms | 1276 KB | Output is correct |
7 | Correct | 453 ms | 1284 KB | Output is correct |
8 | Correct | 3 ms | 1120 KB | Output is correct |
9 | Correct | 5 ms | 1120 KB | Output is correct |
10 | Correct | 2 ms | 1120 KB | Output is correct |
11 | Incorrect | 498 ms | 1336 KB | Wrong query response. |
12 | Halted | 0 ms | 0 KB | - |