## 10656 - Maximum Sum (II)

**Moderator:** Board moderators

### 22.05.04 Contest Problem F, 10656

What the heck does it mean? The wording of the problem is so bad ...

Last edited by brianfry713 on Tue Jan 28, 2014 3:04 am, edited 1 time in total.

**Reason:***thread title*I tried all three possibilities, none of which seemed to work.

### solved

After a couple of trials I managed to solve this one. Here's what you should do to get AC:

- print all non-zero input numbers in their original order

- but if all input numbers are zero, print just one zero

That's it. Great problem huh? So many programming skills and algorithms combined in just one problem....

Erik

- print all non-zero input numbers in their original order

- but if all input numbers are zero, print just one zero

That's it. Great problem huh? So many programming skills and algorithms combined in just one problem....

Erik

But if you do that, isn't your output sequence actually a subsequence of the original input (heck, any output that doesn't have the same number of elements is actually a subsequence, since you have removed some elements)

And by that logic, shouldn't the answer just mirror the input exactly?

And by that logic, shouldn't the answer just mirror the input exactly?

Last edited by UFP2161 on Sat May 22, 2004 5:17 pm, edited 1 time in total.

### Re: solved

If you skip the zeroes, you are printing a sub sequence.Maniac wrote: - print all non-zero input numbers in their original order

- but if all input numbers are zero, print just one zero

If you print more than one number, you break the rule which says that a sequence should have just ONE number (hhuehuehue)

If you print one zero instead of all zeroes you are printing a sub sequence.

I believe that there is no solution, therefore everyone who DID NOT submit should get AC?

I was going to try to trim all left and right side zeroes, and the print the remaining subsequence. Then it would be the smallest subsequence which preserves the order of the elements and wont skip any numbers (zeroes). That wouldnt be the same as Erics solution and wouldnt get ac...

Unfortunately I woke up too late for trying it...

Guilherme Silveira

Technobug, I actually tried your suggested solution and it indeed gave WA as you predicted.

EriK (<- note the K)

P.S. Does anyone know why so many people tend to write my name in the wrong way when there's no reason to assume I mistyped my own name in previous messages?