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.me/contest/1935/problem/C
And here is my code: https://codeforces.me/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!