이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int INF = (int)1e9 + 7;
const int NS = (int)1e3 + 4;
vector<int> label(int n, int k, vector<int> u, vector<int> v) {
vector<int> labels(n);
int label_num = 0, chk[NS];
memset(chk, 0, sizeof(chk));
vector < int > way[NS];
for(int i = 0; i < n - 1; ++i){
way[u[i]].push_back(v[i]);
way[v[i]].push_back(u[i]);
}
function < void(int, int) > dfs = [&](int x, int dep){
chk[x] = 1;
if(dep % 2) labels[x] = label_num++;
for(auto&nxt:way[x]){
if(chk[nxt]) continue;
dfs(nxt, dep + 1);
}
if(dep % 2 == 0) labels[x] = label_num++;
};
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(s < c[0]){
if(t < s || t > c[(int)c.size() - 2]) return c.back();
for(auto&i:c){
if(t <= i) return i;
}
}
else{
if(t < c[1] || t > s) return c.front();
for(int i = (int)c.size() - 1; ; --i){
if(t >= i) return c[i];
}
}
while(1){
puts("WHAT");
}
}
# | 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... |