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

×

[closed] WA in spoj GSS1

http://www.spoj.com/problems/GSS1/

https://ideone.com/WtT3xh

Getting WA repeatedly . Can anyone help??

asked 15 Nov '14, 13:29

abeyaar's gravatar image

1★abeyaar
33422140
accept rate: 30%

closed 22 Dec '14, 10:09

The question has been closed for the following reason "The question is answered, right answer was accepted" by abeyaar 22 Dec '14, 10:09


Consider this testcase:


5
3 -5 4 7 0 
1 
1 5

Your output is 14 (3+4+7). The correct answer is 11 (4+7). The problem requires you to print the maximum sum of a subrange in a given range. If the given range is 1 5 and you choose a subrange 1 4 your sum will be 9 (not 14 as your output, you can't ignore negative numbers). The maximum sum occurs in the subrange 3 4 with as sum of 11.

link

answered 16 Nov '14, 12:08

michelangelo's gravatar image

4★michelangelo
1.1k21522
accept rate: 39%

Yeah I got my mistake..however the correct java program is giving TLE even with fast I/O and there are only 7-8 successfull java submissions for this problem. So I am now trying in C

(16 Nov '14, 18:28) abeyaar1★

@abeyaar ...Can you please tell me the change which helped you out.I am getting WA on 9th Judge, used the concept just like you ..My code is https://ideone.com/FqZ6Zq

(08 Dec '15, 23:20) nickzuck_0073★

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:

×1,768
×1,137

question asked: 15 Nov '14, 13:29

question was seen: 2,404 times

last updated: 08 Dec '15, 23:20