# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
237236 | IgorI | Cat in a tree (BOI17_catinatree) | C++17 | 280 ms | 524292 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>
using namespace std;
typedef long long ll;
const int N = 200000;
const int K = 2000;
int n, d;
int dp[N][K];
int p[N];
vector<int> graph[N];
void dfs(int v)
{
for (auto u : graph[v]) dfs(u);
dp[v][0] = 1;
for (auto u : graph[v]) dp[v][0] += dp[u][d - 1];
for (int j = d; j > 0; j--)
{
if (2 * j >= d)
{
for (auto u : graph[v])
{
dp[v][j] += dp[u][j - 1];
}
}
else
{
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... |