南京多校出题~

Little A and little B are playing stone games.There are N N N bottles,labeled 1 to N N N,each with a capacity of A i A_i Ai.Initially,the bottles are all full.
In each turn,the player takes a certain amount of stones from every bottle. Different from the past, each person takes up at most r i r_i ri stones from each bottle, ( r i &lt; = a i r_i&lt;=a_i ri<=ai), and at least takes l i l_i li stones ( l i &gt; = 0 l_i&gt;=0 li>=0),and put them into the stone library(initially empty).
When r i r_i ri is greater than a i , r i = m i n ( r i , a i ) a_i, r_i=min(r_i, a_i) ai,ri=min(ri,ai), when l i l_i li is greater than a i a_i ai, l i = m i n ( l i , a i ) l_i=min(l_i, a_i) li=min(li,ai). You can also choose to take some of the stones from the stone library (independent of the stone pile) and put them back into the original bottle.The first person who takes all the stones wins.
You can assume that everyone takes the best strategy.

Input

First line, N , K ( 1 &lt; = K &lt; = N &lt; = 1 e 6 ) N, K (1&lt;=K&lt;=N&lt;=1e6) N,K(1<=K<=N<=1e6)
The second line a 1 , a 2 , . . . , a n ( 0 &lt; = a i &lt; = 1 e 9 ) a_1, a_2, ..., a_n (0 &lt;= ai &lt; = 1e9) a1,a2,...,an(0<=ai<=1e9)
The third line l 1 , l 2 , . . . , l n l_1, l_2, ..., l_n l1,l2,...,ln
The fourth line r 1 , r 2 , . . . , r n ( 0 &lt; = l i &lt; = r i &lt; = a i ) r_1, r_2, ..., r_n(0&lt;=l_i&lt;=r_i&lt;=a_i) r1,r2,...,rn(0<=li<=ri<=ai)

Output

If A wins,print one line “A”,
else if B wins,print one line “B”,
else print one line “Draw”.

Sample Input

3
0 1 2
0 0 0
0 1 2

Sample Output

A

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值