1172. Spend the most money and get the cheapest resources