WA in "Khaled in HIT" (HIT)

Here’s a problem of codechef october lunchtime Khaled in HIT

Here’s my Solution

I’ve tried quite of few cases and the answers is same as generated by editorialist’s code. But I’m getting WA on submission. Can anyone help?

Try

1
8
1 2 3 4 5 6 6 7

Your output:

3 5 6

Correct output:

-1
2 Likes

Thanks for the help, I got it.