SEGSQRSS Solution

Problem : http://www.spoj.com/problems/SEGSQRSS/

My Solution : eTwPd4 - Online C++0x Compiler & Debugging Tool - Ideone.com

Although my solution works on SPOJ, but it fails for the following test case :

1

4 6

1 2 3 4

0 1 4 -5

1 2 4 -2

2 1 1

2 2 2

2 3 3

2 4 4

Can Someone please Explain me the problem with my code as to why this test case fails?

2 Likes