이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> label(int n, int k, std::vector<int> u, std::vector<int> v) {
vector<int> labels(n);
vector<vector<int>>adj(n);
for (int i = 0;i<n;++i){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
int time = 0;
function<void(int,int)>dfs = [&](int x,int par){
labels[x] = time++;
for (auto y:adj[x]){
if (y == par)continue;
dfs(y,x);
}
};
dfs(0,-1);
return labels;
}
int find_next_station(int s, int t, std::vector<int> c) {
if ((int)c.size() == 1)return c[0];
if ((int)c.size() == 2){
if (c[0] > c[1] && c[0] <= t){
return c[0];
}
if (c[1] > c[0] && c[1] <=t){
return c[1];
}
if (c[0] <= t)return c[0];
return c[1];
}
return c[0];
}
# | 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... |