ADADET - WA

2017
adadet
cookoff
june
wa

#1

Can anyone help me with the WA test cases of ADADET problem of June Cookoff 2017? More specifically which conditions am I missing?

Here is my solution: https://www.codechef.com/viewsolution/14285726


#2

There are multiple test cases, you are outputing the last -1 at the wrong place. Secondly, your solution can TLE because it’s O(n^2), but the problem states n \leq 10^5. Try optimizing your solution first.


#3

Same Here. I Tried My Code on many different test-cases , all passing but on submission WA.
Link to my Submission : https://www.codechef.com/viewsolution/14304164