## 10656 - Maximum Sum (II)

Moderator: Board moderators

### 10656

Could someone give me more test case?

in:
5
1
2
3
0
0
3
1
1
1
3
0
0
0
0

out:
1 2 3
1 1 1
0
htl
Experienced poster

Posts: 185
Joined: Fri Jun 28, 2002 12:05 pm
Location: Taipei, Taiwan

### Re: 10656

htl wrote:How about the in/out below?

Same with my AC code.

angga888
Experienced poster

Posts: 143
Joined: Sat Dec 21, 2002 11:41 am
Location: Indonesia

I am also trying to solve this problem, but get WA always, I get the same output for given input in example and for yours.
Some more input:
Code: Select all
`5-110-510111821-11-512091110-1000210`

and my output:
Code: Select all
`10 -5 10 112 12 1`
pudinzi
New poster

Posts: 5
Joined: Sat Jun 05, 2004 10:18 pm

Each of the next N lines contains a single non-negative integer.

Here is a valid test input to check your program:
5
0
1
0
1
0
0

Output should be
1 1
Guru

Posts: 724
Joined: Wed Dec 19, 2001 2:00 am
Location: Germany

pudinzi
New poster

Posts: 5
Joined: Sat Jun 05, 2004 10:18 pm

### 10656 - Need help

Please help me for this problem. I am getting WA. I tried all input available in the forum. But still WA. Here is my code please check it out.

/* I got it now */

Thanks every body
Last edited by Junayeed on Mon Aug 30, 2004 2:54 pm, edited 1 time in total.
Junayeed
New poster

Posts: 50
Joined: Sat Oct 26, 2002 9:02 am

Two mistakes. First, you print a space after each number, and after the last number, you shouldn't. Second, in the method 'allZero' you loop from 0 to MD where you should loop from 0 to N.
Sample input to show your mistakes:
Code: Select all
`23 410`

Your output (spaces replaced by _):
Code: Select all
`3_4_<blank line>`

Should be:
Code: Select all
`3_40`
krijger
New poster

Posts: 39
Joined: Wed Jul 21, 2004 12:35 am

Thanks krijger.
I got ACC now but with P.E. .
Any way thanks u again

Junayeed
Junayeed
New poster

Posts: 50
Joined: Sat Oct 26, 2002 9:02 am

### 10656 - Maximum Sum (II)

I can't understand what the hell problem means? Anyone please make me clear.... what to do in this problem......
faltoo
faltooreza
New poster

Posts: 2
Joined: Sun Sep 05, 2004 11:25 am

i don't know why u get so much confused in this problem. it's a mock test type problem. just print the subsequence which has maximum summation value from the given sequence. if the input is like,
3
2
0
5
then the output will be 2 5. if two sequence has the same value then we need to print the sequence which has minimal lenght. here 2 5 has 2 length but 2 0 5 would be length of 3
prince56k
New poster

Posts: 33
Joined: Fri Dec 12, 2003 10:32 pm

But is 2 5 a subsequence here? what does subsequence mean here? how can 2 5 be a sequence, there is a 0 in the middle , doesn't it seperate 2 and 5 into 2 subsequences or any combination of the numbers means a subsequence in this problem
Jalal : AIUB SPARKS

CodeMaker
Experienced poster

Posts: 183
Joined: Thu Nov 11, 2004 12:35 pm

### defn of subsequence...

Definition of subsequence : subsequence is a term used to mean a sequence derived from a sequence S by discarding some of its terms.
-- from mathworld

So, in the above example 2 5 is a subsequence of the given sequence.

sohel
Guru

Posts: 862
Joined: Thu Jan 30, 2003 5:50 am
Location: University of Texas at San Antonio

hmm, thanks... looks like I have problems in basic
Jalal : AIUB SPARKS

CodeMaker
Experienced poster

Posts: 183
Joined: Thu Nov 11, 2004 12:35 pm

Thanks to Adrian Kuegel !!! At last I got Accepted!
Stummer
New poster

Posts: 12
Joined: Sat Jul 01, 2006 12:16 pm
Location: Munich, Germany

### can anyone tell why WA

why this is wa
is there any critical way to solve
this
Code: Select all

bishop
New poster

Posts: 43
Joined: Fri May 04, 2007 12:57 pm

Next