For those of you requesting (that hardcore implementation) problem A code here it goes: It is quite self explanatory and took me 2 hrs to pass it during the contest :
what a fuck all question it was.
did it pass , mine codevita is in zone but by solving zone 1 ques i came uo with same approach ,i thought it will not pass because complexity is much please ans as soon as possible
here is the link
Yes it passed, with presentation error though.