Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int j = 0; j <= maxCount; j++) {
- int max_ = 0;
- for (int all = 1; all < j; all++) {
- int m = memory[l_ix][all] + memory[r_ix][j - all];
- if (m > max_) max_ = m;
- }
- if (j == maxCount) {
- max_ = max(max_, memory[l_ix][j - 1]);
- max_ = max(max_, memory[r_ix][j - 1]);
- }
- memory[i][j] = max_ + tree[i];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement