# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
553467 | Talha_Taki | Cat in a tree (BOI17_catinatree) | C++17 | 1091 ms | 45376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
vector <vector <int>> adj, parent;
vector <int> tin, tout, depth;
set <pii, greater <pii>> S;
int k, timer;
void dfs(int u, int p, int d) {
depth[u] = d;
tin[u] = ++timer;
S.insert({d, u});
for(int i = 1; i <= k; ++i) parent[u][i] = parent[parent[u][i-1]][i-1];
for(int v : adj[u]) {
if (v == p) continue;
dfs(v, u, d+1);
}
tout[u] = ++timer;
}
inline bool isAncestor(int u, int v) {
return tin[u] <= tin[v] && tout[u] >= tout[v];
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |