D: Yet Another Monster Killing Problem Codeforces how to solve it?

Problem - Problem - D - Codeforces
My solution - Submission #64891555 - Codeforces (Got tle, obviously)

My approach-

  1. Sort the power array of heroes.
  2. Iterate from first to last on the monsters
  3. While calculating which monster to choose, I am applying a binary search to find index of heropower>= powerofMonster.
  4. Then I iterate all the vertices after that in linear time and choose the one which will kill maximum monsters.

Any help how can I optimize my approach further or would like to know how did you solve it?
I checked the submissions mostly I found out the segment tree approach but I don’t know it.

Would like to know your creative approach.
Thank you :slight_smile:

1 Like

I am also waiting for the tutorials. whats ur cf handle btw???

1 Like

Can You explain the solution of problem F, same contest…

Loved it bro… had watched tags only, will try it again now.

1 Like

Yours?

Please check my code because I cannot understand what I am missing and why? (help will be appreciated)…

yay spoonfeeding.

3 Likes