# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
696715 | garam1732 | Stations (IOI20_stations) | C++14 | 2621 ms | 2097152 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 "stations.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1010];
int cnt = 0;
void dfs(int here, int par, vector<int>& v) {
for(int there : adj[here]) {
if(there == par) continue;
dfs(there, here, v);
}
v[here] = cnt++;
}
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
std::vector<int> labels(n);
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, i, labels);
return labels;
}
}
}
int find_next_station(int s, int t, std::vector<int> c) {
if((t-s)*(c[0]-s)>0) return c[0];
return c[1];
}
Compilation message (stderr)
# | 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... |