PNTNG - Editorial

I should have solved this question in C++, done in C, wasted time. anyways logic is simple and good question

“Your task is to find the minimum cost of painting the table thus that it can’t be seen thought from the top (there is no cell which is unpainted on every layer)”.

Bold text is a bit misleading! Got WA…:frowning: It meant you can’t leave any layer completely unpainted.

i m getting WA…plz tell me in which cases it is failing : CodeChef: Practical coding for everyone

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!

1 Like

i am not able to get where i am wrong CodeChef: Practical coding for everyone

@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…

I am getting wrong answer, plz tell me why…
http://www.codechef.com/viewsolution/4136227

CodeChef: Practical coding for everyone help

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…

1 Like

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.