???Auction Bidding

Company ABC is holding an antique auction. In the auction, there are NN1 \leq N \leq 10001N1000, lots. We number the lots from 11 to NN. There are MM1 \leq M \leq 5001M500, bidders participated in the auction. We number the bidders from 11 to MM. The winning bid for each lot is determined by the following rules:

• Each lot has a reserved price, which is a positive integer.

• Each bidder may submit at most one bid to each lot whose amount must be a positive integer.

• A valid bid for a lot is one that is at least the reserved price for the lot. All invalid bids are not considered.

• The largest valid bid wins the lot and is called the winning bid. In case of tie bids, the bidder with the smaller bidder number wins. If there is no valid bid for a lot, then this lot is not sold.

• The second largest bid is a valid bid that does not win if one exists; otherwise, it is the reserved price.

• If a bidder wins a lot, then the final hammer price for this lot is either 10\%10% over the second largest bid or the largest valid bid, depending on which one is smaller. If the final hammer price is not an integer, then it is truncated to the nearest integer.

• Given the reserved price and the bids for each lot, your task is to decide the total final hammer prices for a given k, 0 < k \leq M0<kM, bidders.

Input Format

The input contains N + 3 + kN+3+k lines.

Line 11NN

Line 22MM

Line 33r_{1}, b_{1,1}, p_{1,1}, b_{1,2}, p{1,2}, -1r1,b1,1,p1,1,b1,2,p1,2,1

\ldots

Line i + 2i+2r_{i}, b_{i,1}, p_{i,1}, b_{i,2}, p{i,2}, -1ri,bi,1,pi,1,bi,2,pi,2,1

\ldots

Line N + 2N+2r_{N}, b_{N,1}, p_{N,1}, b_{N,2}, p_{N,2}, -1rN,bN,1,pN,1,bN,2,pN,2,1

Line N + 3N+3kk

Line N + 4N+4q_{1}q1

\ldots

Line N + 3 + iN+3+iq_{i}qi

\ldots

Line N + 3 + kN+3+kq_{k}qk

In Line i + 2i+2r_{i}ri is the reserved price for lot ii. The number b_{i,j}bi,j and p{i,j}pi,j are the j^{th}jth bid for lot ii from bidder b_{i,j}bi,jwith the amount p_{i,j}pi,j . Note that a space is between each number. The number -11 is added to mark the end of bids for a lot. In Line N+3N+3kk is given. In line N + 3 + iN+3+i, you are asked to provide the total hammer prices for bidder q_{i}qi.

Output Format:

The output contains kk lines.

Line 11h_{1}h1

\ldots

Line iih_{i}hi

\ldots

Line kkh_{k}hk

The total hammer prices for bidder q_{i}qi is h_{i}hi.

Hint

In the sample, the bidder 11 got the the first lot 11 at hammer price 1313.

样例输入
3
3
11 2 12 1 15 -1
5 3 4 -1
23 1 32 2 35 3 40 -1
1
1
样例输出
13
题目来源

2017 ACM-ICPC 亚洲区(南宁赛区)网络赛

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值