Binary Search way to do this?
How can I implement this question using binary search? https://codeforces.com/contest/1177/problem/B