Can be solved easily in C++ using the STL map! the index can be the cost, and the corresponding maximum tiles can be the data, i.e., map[ck]+=tk.
i am getting wrong answer for CodeChef: Practical coding for everyone, can someone tell me where i am going wrong
For this testcase some accepted solutions are giving incorrect output
2 5 4
4 0
0 4
9 2
1 19
Answer should be 12 but I found one accepted solution which was giving answer as 37!
@admin can anyone see y im getting a wrong answer for this submission… I used bubble sort… a tle is expected but its giving wrong answer… Test cases and max values seem fine… CodeChef: Practical coding for everyone
CodeChef: Practical coding for everyone this is an accepted solution… while CodeChef: Practical coding for everyone shows runtime error…can admins tell me why i got an error in the second one even though code is same…
Can’t understand , how we have to paint only n*m cells…??and what’s this mean"vertical column in layer"…??
optimization : Inside the for loop add if(topaint==0)break;
n and m can not be stored in int. n * m <= 10^12
hell man :\
provide the strong test cases as many of us have failed…
i don’t think so…
I have provided test cases for as much codes as I could have done, please check one other thread in the discussions too where I have given some test cases.
please explain the 1st test case in detail. The problem is still unclear to me. what is meant by table should not be seen through top and no two vertical columns should be unpainted?
It will be better to choose std::multimap instead of std::map, for the simple reason that the cost can be same for more than one layer.
no need of multimap… you can add tk to the value stored along key ck in a map itself
I think using map is also correct. As we are only interested in cost and no. of tiles that can be painted with that cost.
I think you have misunderstood.To know why refer this link :
http://discuss.codechef.com/questions/42356/doubt-regarding-tle-wrong-answer