COLARR - Editorial

Call it bad luck, weak test cases whatever, but you agree, that 5 is correct, right?

and this is an invalid test case too which doesnā€™t follow the last constraint

in C1 -> C2 -> C3 the cost is a + b, in C1 - > C3 cost is b, how can a + b be less than b if a, b >= 0 ?

@betlista no the correct answer is 6 because no repainting is required
P.S. you solution also returns 6

Sorry, my bad, Iā€™ll do it betterā€¦

Oh, my bad. Misunderstood the whole thing. Thanks, mate. :slight_smile:

1 Like

Iā€™m not able to find the smaller one for now only for N = 50 and M = 25 with K = 625. Recently Iā€™m not able to upload to pastebin, will let you know later today.

please please help me find a test case for which my solution doesnt work
http://www.codechef.com/viewsolution/3437870

@yagyank : Without coloring the grid, you can score a maximum of 4 not 6.

you must have made mistake in code : especially in this part B[i][j] - B[i][A[i]] - C[i][j] ā€¦ But, if you code as B[i][j] - B[i][A[i]] - C[i][A[i]] => you will get 6 which is incorrect.

@zmmloser if you are talking about the case given by betlista then asnwer is 6. All the AC solutions also return 6! and i have coded like B[i][j]-B[i][A[i]]-C[i][j]ā€¦not like the other way

Guys, take a look at my answer. I have seen that almost all programs given above fail in one or two test cases given by me.

1 Like

thanks a lot ā€¦i corrected one mistake in the code but it still shows wrong answer
http://www.codechef.com/viewsolution/3443912

hi please look at my solution, i am not able to identify where it is failingā€¦tried several test cases and still got required answer
http://www.codechef.com/viewsolution/3371975

@rishabh1994 Your sorting method has some bug. I used built in sort method and got TLE. But after converting cin/cout to scanf/printf I could get it AC ā†’ CodeChef: Practical coding for everyone

1 Like

@rishabh1994 I changed your ā€œpartitionā€ method to something that I know and got AC ā†’ CodeChef: Practical coding for everyone

thank you so much for the help

@unavowed Yeah, you are right. Your solution is perfect, but it fails whenever there is at least one extra space or newline character. Fix your get_number() method and you will get AC ā†’ CodeChef: Practical coding for everyone

1 Like

read about knapsack 0-1. I think it will help

I know about 0-1 knapsack. But you canā€™t apply it here because of large constraints

hello all, shouldnā€™t the delta be like
delta[i]=max(B[i][j],B[i][A[j]]-C[i][j]). I didnā€™t get why is is
B[i][j] - B[i][A[i]]) - C[i][j]. Please help. Thanks