# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1174764 | Tien_Noob | Cat in a tree (BOI17_catinatree) | C++20 | 71 ms | 139588 KiB |
//Make CSP great again
//Vengeance
#include <bits/stdc++.h>
#define TASK "TESTCODE"
using namespace std;
const int N = 2e5;
vector<int> adj[N + 1];
int n, d;
deque<int> dp[N + 1];
void read()
{
cin >> n >> d;
for (int i = 1; i < n; ++ i)
{
int u;
cin >> u;
adj[u].push_back(i);
}
}
void DFS(int u)
{
dp[u].push_back(1); //dp[u][0] = 1
for (int v : adj[u])
{
DFS(v);
dp[v].push_front(dp[v].front());
if (dp[u].size() < dp[v].size())
{
swap(dp[u], dp[v]);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |