Please help, want to know error in my code.

Revision en1, by notsoawesome, 2024-03-17 16:29:02

Hi there, apologies for a newbie post. I wanted to know error (possibly corner case) in my code. It would be really heplful.

Actually I want to get back in to competitive programming. Most of the time, I was able to find the corner cases to my error prone code, but since I lost the habit of doing competitive, I am having trouble with this simple thing.

Here is the problem: https://codeforces.com/contest/1935/problem/C

And here is my code: https://codeforces.com/contest/1935/submission/251937077

What I tried to do is simple. Sort in terms of b, and then finding the appropriate a's between two indexes and brute forcing it across the array to get the maximum.

In order to find a efficiently, I used multiset.

  • first optimizing as per the lowest possible a's and removing the largest
  • and then adding whatever we can

It would be really helpful. Thanks!

Tags greedy, help!

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English notsoawesome 2024-03-17 16:29:02 925 Initial revision (published)