WA in THEATRE (Feb Long Challenge 2020)

I have read the editorial and understood the approach. Can someone please tell me in which test case my code fails.
My basic approach is:

  1. Take a frequency matrix based on given input (column denotes time and each row is for each movie.)
  2. Take a set. Take the maximum value in row.
  3. Insert the column index of max value in a set (So we don’t use the same time again).
  4. 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 :slight_smile:


A 3
A 12
A 9
A 6
A 3

Your code outputs -200, whereas answer is -100

This testcase should be enough of a hint to find out where you went wrong


Thanks for the answer :slight_smile: . Now i feel so bad for missing such simple test case :frowning: