이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "stations.h"
#include <bits/stdc++.h>
using namespace std;
#define isz(a) (int)(a).size()
const int NM = 1000;
vector <int> adj[NM+5];
int dep[NM+5];
int timer = 0, tin[NM+5], tout[NM+5];
vector <int> arr;
void dfs(int u, int p){
dep[u] = (p == -1 ? 0 : dep[p]+1);
tin[u] = ++timer;
for (int v : adj[u]){
if (v == p) continue;
dfs(v, u);
}
tout[u] = ++timer;
}
vector <int> label(int n, int k, vector <int> u, vector <int> v){
/*for (int i = 0; i < n-1; i++){
adj[u[i]].push_back(v[i]);
adj[v[i]].push_back(u[i]);
}
dfs(0, -1);
for (int i = 0; i < n; i++){
if (dep[i]&1) arr.push_back(tout[i]); else arr.push_back(tin[i]);
}
sort(arr.begin(), arr.end());*/
vector <int> ans(n);
/*for (int i = 0; i < n; i++){
if (dep[i]&1) ans[i] = lower_bound(arr.begin(), arr.end(), tout[i])-arr.begin();
else ans[i] = lower_bound(arr.begin(), arr.end(), tin[i])-arr.begin();
}*/
return ans;
}
int find_next_station(int s, int t, vector <int> c){
if (s < c.front()){
if (t < s || t > c.back()) return c.back();
for (int i = 0; i+1 < isz(c); i++)
if (c[i] >= t) return c[i];
return -1;
}
else{
if (t < c.front() || t > s) return c.front();
for (int i = isz(c)-1; i > 0; i--)
if (c[i] <= t) return c[i];
return -1;
}
}
# | 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... |