Same code giving different output for same input

I am solving [STPAR][1]. And I made this


[2]. Now look at this test case

    5
    1 2 4 3 5

It gives `no` as output.

But if I give this test case individually when run again.. [link][3] , it gives `yes` as output. I don't understand why this is happening. Can anyone please explain..


  [1]: http://www.spoj.com/problems/STPAR/
  [2]: http://ideone.com/HmTfuk
  [3]: http://ideone.com/YG7Kkt

Answering to myself :slight_smile: . Pretty late though…

After debugging got this solution. On initialising array a to zero, a[1100]={0}, solved the problem. link

//