Suppose total t unit time needed to fulfill all his friend’s requirements. Now how can we check that it is possible in t unit time? We always try to give Miners coins as much as possible.
If x>=y and x* t is less than any of friends requirement then it is impossible within t time.
If x<y and x*t is less than any of friends requirement then we will count the total number of y coins needed for this kind of friends. If the summation of all of the friends needed y types of coins is greater than t then it is impossible.
Otherwise it is always possible within t time.
Now how can we fix the t. We can do it using binary search and want to do it in minimum possible t.
Binary Search takes O(log(10^9)) time and checking procedure takes O(n) time. So overall complexity is O(n*log(10^9)).