# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
132710 | youngyojun | Cat in a tree (BOI17_catinatree) | C++11 | 207 ms | 16280 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define eb emplace_back
using namespace std;
const int MAXN = 200055;
vector<int> G[MAXN];
int prt[MAXN], dep[MAXN];
int A[MAXN], O[MAXN];
int N, D, Ans;
void f(int i) {
if(A[i] < 2) return;
int l = A[i]-1;
for(int v : G[i]) if(A[v] < l) {
A[v] = l;
f(v);
}
}
int main() {
ios::sync_with_stdio(false);
cin >> N >> D;
for(int i = 1; i < N; i++) {
cin >> prt[i];
dep[i] = dep[prt[i]] + 1;
G[prt[i]].eb(i);
G[i].eb(prt[i]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |