Oops! You and your co-op member just got scammed of all your valuables in Hypixel Skyblock, and you need to get it back. Thankfully, from previous investments for the Crimson Isle update, and Auction House flipping, you are still stacked with coins. Skyblock lets you buy and sell resources using the Bazaar. The Bazaar acts like a stock market, where item prices are based on supply, demand, and of course, value.
You have items you would like to purchase. For any item on the Bazaar, there are two methods you can use to purchase it: Insta-buy and Buy order. Insta-buy is in the name; you receive the items the moment you purchase them, for
coins. Buy orders allow you to purchase the items at a lower cost than insta-buying, at
coins. However, buy orders require you to wait for another player to sell that item, so it can fill your order. As a result, it often takes some time,
, to receive your item.
Due to your co-op member taking up all the bazaar buy slots, you are only able to have 1 pending buy order at a time. The Bazaar is an extremely volatile market, and prices change in minutes. Within
minutes, what is the minimum amount of coins you must pay to obtain all
items? As well, which items should you insta-buy and which ones should you make a buy order for?
Subtasks
, and will only contain alphanumeric characters and
_
.
Subtask 1 [30%]
Subtask 2 [70%]
No further constraints.
Input Specifications
The first line contains space separated integers , and
.
The next lines will contain a string
, the name of the item, then followed by space separated integers
.
is the insta-buy price, while
is the buy order price, and
is the number of minutes it will take for that order to fill if you purchase with a buy order.
Output Specifications
On the first line, output the minumum amount of coins required to purchase all items.
For the next lines, for each item
, output the item name, and then
insta-buy
if you will insta-buy the item, or buy order
if you will make a buy order for the item.
Sample Input
5 10
Fine_Ruby_Gemstone 2000 1500 3
Turbo_Wheat_I 12000 10500 1
Kuudra_Teeth 6000 5000 4
Enchanted_Mycelium 3000 2750 2
Enchanted_Mithril 7000 5000 6
Sample Output
26000
Fine_Ruby_Gemstone buy order
Turbo_Wheat_I buy order
Kuudra_Teeth insta-buy
Enchanted_Mycelium insta-buy
Enchanted_Mithril buy order
Explanation for Sample Output
By setting buy orders for Fine Ruby Gemstone, Turbo Wheat I, and Enchanted Mithril, you will save 4000 coins, and take minutes, which does not exceed
. It can be shown that 4000 is the most amount of coins you can save.
Comments