제출 #607581

#제출 시각아이디문제언어결과실행 시간메모리
607581skittles1412Stations (IOI20_stations)C++17
0 / 100
873 ms532 KiB
#include "bits/extc++.h"

using namespace std;

template <typename T>
void dbgh(const T& t) {
    cerr << t << endl;
}

template <typename T, typename... U>
void dbgh(const T& t, const U&... u) {
    cerr << t << " | ";
    dbgh(u...);
}

#ifdef DEBUG
#define dbg(...)                                              \
    cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \
    dbgh(__VA_ARGS__);
#else
#define dbg(...)
#define cerr   \
    if (false) \
    cerr
#endif

#define endl "\n"
#define long int64_t
#define sz(x) int((x).size())

const int maxn = 1005;

int t, tin[maxn];
vector<int> graph[maxn];

void dfs(int u, int p = -1) {
    tin[u] = t++;
    for (auto& v : graph[u]) {
        if (v != p) {
            dfs(v, u);
        }
    }
}

vector<int> label(int n, int, vector<int> u, vector<int> v) {
    for (int i = 0; i < n; i++) {
        graph[i].clear();
    }
    for (int i = 0; i < n - 1; i++) {
        graph[u[i]].push_back(v[i]);
        graph[v[i]].push_back(u[i]);
    }
    t = 0;
    dfs(0);
    return vector<int>(tin, tin + n);
}

int find_next_station(int, int t, vector<int> c) {
    if (t <= c[0]) {
        return c[0];
    }
    return *(--upper_bound(begin(c), end(c), t));
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...