# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
348370 | dennisstar | Stations (IOI20_stations) | C++17 | 1180 ms | 1248 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "stations.h"
using namespace std;
const int MX = 1e3 + 5;
vector<int> L, adj[MX];
int O;
void dfs(int n, int p, int d) {
if (d&1) L[n]=O++;
for (auto &i:adj[n]) if (i!=p) dfs(i, n, d+1);
if ((d-1)&1) L[n]=O++;
}
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
O=0;
for (int i=0; i<n; i++) adj[i].clear();
L.resize(n);
for (int i=0; i<n-1; i++)
adj[u[i]].emplace_back(v[i]),
adj[v[i]].emplace_back(u[i]);
dfs(0, -1, 1);
return L;
}
int find_next_station(int s, int t, vector<int> c) {
if (c.size()==1) return c[0];
if (c[0]>s) {
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |