https://www.codechef.com/viewsolution/28604916
Can someone tell me where I am going wrong?
Consider the test case:-
6
1 2 1 2 1 2
I’m getting the following output :
1 1 2 1
which I think is correct because the maximum depth is 1 and it first occurs at position 1. The maximum size is 2, and it first occurs at 1.
Wait, actually? On my machine, I get something totally different.
Try initializing all your arrays/variables to 0 or something.
I get a different result each time:
[~/devel/hackerrank/otherpeoples]>echo "6
1 2 1 2 1 2" | ./a.out
93918986415009 1 2 1
presumably because you’re not initialising some of your variables - another simple practice that would probably halve all "WA in ___ " threads