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

Neo Nomaly Please Help. I use right DP but I have WA3... [3] // Problem 1146. Maximum Sum 12 Jan 2006 22:06
[code deleted]

Edited by moderator 24.11.2019 13:21
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)
Neo Nomaly Re: Please Help. I use right DP but I have WA3... [1] // Problem 1146. Maximum Sum 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
Thanks, I got AC.
My problem: I wroute : up:=down;
            But need : up:=down+1;