Submission #883401

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8834012023-12-05 08:59:57dimashhhCat in a tree (BOI17_catinatree)C++17
0 / 100
1 ms344 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1501,MOD = 1e9 + 7;
int n,d,dp[N][N];
vector<int> g[N];
void dfs(int v,int pr = -1){
dp[v][0] = 1;
for(int to:g[v]){
if(to == pr) continue;
dfs(to,v);
dp[v][0] += dp[to][d - 1];
}
for(int dep = 1;dep <= n;dep++){
if(d - dep - 1 < 0) continue;
int mx = -1e9;
for(int to:g[v]){
if(to == pr) continue;
dp[v][dep] += dp[to][d - dep - 1];
mx = max(mx,dp[to][dep - 1] - dp[to][d - dep -1 ]);
}
dp[v][dep] += mx;
}
for(int i = n;i >= 1;i--){
dp[v][i] = max(dp[v][i + 1],dp[v][i]);
}
}
void test(){
cin >> n >> d;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

catinatree.cpp:40:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   40 | main(){
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...