You are not logged in. Please login at www.codechef.com to post your questions!

×

Unable to catch the bug in DP problem

I used an array named DP for storing the previously computed answers. First I copied the elements of the first row from array a to the first row of DP. And then I chose the maximum of the respective positions from the previous row of array DP and take a sum of it with the current element of array a and store this value at the respective position in array DP. Although I passed too many test cases but still getting a wrong answer. Please help me figuring out the bug.

Thanks in advance. Link to the source code

Link to the problem

asked 18 Feb, 19:46

spd123's gravatar image

2★spd123
32
accept rate: 0%

edited 19 Feb, 17:08

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×2,214
×1,138

question asked: 18 Feb, 19:46

question was seen: 71 times

last updated: 19 Feb, 17:08