It is already mentioned in editorial that small testset was weak.
@buda It is already stated in editorial that english version of statement is wrong and thus the editorial apporach too. My intended task was exactly the same as @acmonster version of the statement, mentioned in editorial but it seems there was a huge fault here from my side.
There is a flaw in calculating colliding interval. You have considered that it can collide only once but there can be multiple places where it might collide. Eg : [1, 1, 1, 1, 1] and k = 2. All ranges are colliding but you donāt consider such cases. (Note, your solution will be correct for the case I provided, it is just to give you intuition where it might fail).
Can anyone please help me to debug my code of this problem
My code- link
I am getting WA on the last 3 test cases.
I implemented a brute force implementation during the contest which was almost same as the basic idea mentioned in the editorial i.e. updating number at given index and finding min in a given range.
I was targeting the first two sub-tasks at that moment.
However, even after spending quite a bit time on it, it gave me selectively wrong answer. I am posting my last solution here. Any help will be appreciated. Thanks.
Hereās my submission: https://www.codechef.com/viewsolution/19654286
can anyone explain whatās wrong with following codes? I have checked codes many times but I could not figure out what causes my codes to causing SIGSEGV error.
link to my solution - https://www.codechef.com/viewsolution/19877450
Can anyone please explain the fault in my codeā¦I have given this question a lot of time still no improvment ;
anyone? :0
@likecs could you help??
Can anybody plz tell why I am getting wrong answer in the very last test case ???
I am stuck at it for too long !!
Any help will be appreciated ā¦
Thanks in advance !