ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1146. Maximum Sum

Please Help. I use right DP but I have WA3...
Posted by Neo Nomaly 12 Jan 2006 22:06
[code deleted]

Edited by moderator 24.11.2019 13:21
Re: Please Help. I use right DP but I have WA3...
Posted by wwwwww 12 Jan 2006 23:53
You have overflow:

...
up:=1;
for down:=1 to n do begin
sum:=b[j,down]-b[j,up-1]-b[i-1,down]+b[i-1,up-1];
...

In first step b[j,up-1] = b[j][0] but b is
array[1..maxn,1..maxn] of longint (0 is invalid)
Re: Please Help. I use right DP but I have WA3...
Posted by Neo Nomaly 15 Jan 2006 13:33
Thanks, but after chaging
a,b:array[1..maxn,1..maxn] of longint
to
a,b:array[0..maxn,0..maxn] of longint
i also have WA3
Re: Please Help. I use right DP but I have WA3...
Posted by Loch 16 Jan 2006 16:49
Thanks, I got AC.
My problem: I wroute : up:=down;
            But need : up:=down+1;