Can you please give a test-case for which my code fails? WA_CODE @tamo11 you seem to have used a similar approach, it’d be great if you could check once if it’s something very obvious that I’m missing.
If that is the case then probably the test-cases were weak as THIS solution also got an AC, it’s O(TN*max(A_i)). Secondly please make sure that samples match the input format given next time.
Sorry it is not possible because this contest was internal college contest so this question will not move in practice section that’s why it is not possible to submit after contest