problem (http://codeforces.com/problemset/problem/281/B) how to approach this problem ....is there any article or concept which needs to be covered to solve this kind of problem(if it is please suggest )....i am stuck with this since 2 days ...actually i have a logic but that is not efficient enough so getting TLE asked 26 Jun '17, 13:20

So, here is the approach: Given that 1<=b<=n and a>=0, you have to find a pair a,b such that 1.Declare a variable 2.Loop from 3.Do binary search for number, where low = 0 and high = 100001 and made a check for 4.After binary search check which one is minimum 5.Now check for Minimum b/w saved number and min, change min accordingly. Here is the heart of the problem:
Happy coding! answered 26 Jun '17, 16:14
I was bounding the search b/w 0 and 100001, according to the max. limit of constraints.
(26 Jun '17, 18:23)
thanx man!! for the solution and the last problem you answered that was really helpful(union find ds)....
(26 Jun '17, 18:24)
