I have read the editorial and understood the approach. Can someone please tell me in which test case my code fails.
https://www.codechef.com/viewsolution/29498566
My basic approach is:
- Take a frequency matrix based on given input (column denotes time and each row is for each movie.)
- Take a set. Take the maximum value in row.
- Insert the column index of max value in a set (So we don’t use the same time again).
- Go through all rows and finally calculate the answer.
I’m getting right answer for all example test cases when i ran it.
Please help in where my approach is going wrong.
Thanks
Peace!