https://www.codechef.com/viewsolution/36853729
Why did my code miss few test cases?
Please help out.
1 Like
your code fail for this test case
12 2
3 3 3 5 5 5 5 1 5 1 5 1
correct ans : 13 your ans :14
3 Likes
15 3
1 1 1 2 3 1 1 1 2 3 1 1 1 2 3
Your code gives 18 for this, but the answer is 17
One posssible solution is, we will have 3 tables,
1 - [1 to 7] (with cost 8)
2 - [8 to 10] ( with cost 3)
3 - [11 to 15] ( with cost 6)
So total cost is 17
2 Likes
k=3 n=12
1 2 3 4 4 5 1 2 3 4 4 5
asnwer-10 {1,2,3,4,4,5} and {1,2,3,4,4,5}
your answer is 15
1 Like
Can u explain how the answer is 11?
what are the result tables?
corrected it!!
I just ran it against my recursive solution and got 13 11 was incorrect sorry!!
Thanks