Please help, want to know error in my code.

Правка en1, от 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://mirror.codeforces.com/contest/1935/problem/C

And here is my code: https://mirror.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!

Теги greedy, help!

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский notsoawesome 2024-03-17 16:29:02 925 Initial revision (published)