fork download
  1. dp[src][1] = c[src];
  2. for(int i = n; i >= 2; i--){
  3. ll to = -inf;
  4. for(int j = 1; j <= i; j++){
  5. if(j == i) to = max(to, dp[src][i]);
  6. else{
  7. if(dp[u][i - j] != -inf && dp[src][j] != -inf) to = max(to, dp[u][i - j] + dp[src][j]);
  8. }
  9. }
  10. dp[src][i] = max(dp[src][i], to);
  11. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:1: error: ‘dp’ does not name a type
 dp[src][1] = c[src];
 ^~
prog.cpp:2:1: error: expected unqualified-id before ‘for’
 for(int i = n; i >= 2; i--){
 ^~~
prog.cpp:2:16: error: ‘i’ does not name a type
 for(int i = n; i >= 2; i--){
                ^
prog.cpp:2:24: error: ‘i’ does not name a type
 for(int i = n; i >= 2; i--){
                        ^
stdout
Standard output is empty