ALC002 wrong answer
what is wrong with my solution

See my answer in this thread, and probably @anon55659401’s as well :slight_smile:


Actually, you seem to pass his testcase, though you’re failing my one :slight_smile:

bro how can you type 10^5 for 10^5 times because if you give input size 10^5 you will have to give 10^5 values

Do you have access to a “computer”? They can help to automate repetitive work like this :slight_smile:

bro isnt there any small input for which my code fails?
can somebody tell the fault in my logic as it seems correct to me (code is self explanatory)

@cubefreak777 - consider e.g.

8 4
0 59 81 86 81 33 59 64 

@ssjgz what about mine?

I’ve already given you a failing testcase! :slight_smile: I can’t find any “small” ones which yours fail.

@ssjgz okk mate have you solved that alc001 question?

No, I haven’t looked at it yet.

@ssjgz if you will get the approach just tell me