CF658A Bear and Reverse Radewoosh
题目描述
Limak 和 Radewoosh 将要竞争参加一场算法比赛。他们实力相当,但不以同样的顺序答题。
有 $n$ 个问题。第 $i$ 个问题有 $p_i$ 分,需要 $t_i$ 分钟解出。题目按难度排序,也就是说 $p_i
输入格式
第一行包含两个整数 $n$ 和 $c$ ($1\le n\le 50,1\le c\le 1000$),代表题目数量和扣分速度。
第二行包含 $n$ 个整数$p_1,p_2,p_3,...,p_n$,代表题目分值
第三行包含 $n$ 个整数$t_1,t_2,t_3,...,t_n$,代表题目解答时间
输出格式
如果 Limak 赢了,输出`Limak`;
如果 Radewoosh 赢了,输出`Radewoosh`;
如果平局,输出`Tie`。
Translated by TianLuen
说明/提示
In the first sample, there are $ 3 $ problems. Limak solves them as follows:
1. Limak spends $ 10 $ minutes on the $ 1 $ -st problem and he gets $ 50-c·10=50-2·10=30 $ points.
2. Limak spends $ 15 $ minutes on the $ 2 $ -nd problem so he submits it $ 10+15=25 $ minutes after the start of the contest. For the $ 2 $ -nd problem he gets $ 85-2·25=35 $ points.
3. He spends $ 25 $ minutes on the $ 3 $ -rd problem so he submits it $ 10+15+25=50 $ minutes after the start. For this problem he gets $ 250-2·50=150 $ points.
So, Limak got $ 30+35+150=215 $ points.
Radewoosh solves problem in the reversed order:
1. Radewoosh solves $ 3 $ -rd problem after $ 25 $ minutes so he gets $ 250-2·25=200 $ points.
2. He spends $ 15 $ minutes on the $ 2 $ -nd problem so he submits it $ 25+15=40 $ minutes after the start. He gets $ 85-2·40=5 $ points for this problem.
3. He spends $ 10 $ minutes on the $ 1 $ -st problem so he submits it $ 25+15+10=50 $ minutes after the start. He gets $ max(0,50-2·50)=max(0,-50)=0 $ points.
Radewoosh got $ 200+5+0=205 $ points in total. Limak has $ 215 $ points so Limak wins.
In the second sample, Limak will get $ 0 $ points for each problem and Radewoosh will first solve the hardest problem and he will get $ 250-6·25=100 $ points for that. Radewoosh will get $ 0 $ points for other two problems but he is the winner anyway.
In the third sample, Limak will get $ 2 $ points for the $ 1 $ -st problem and $ 2 $ points for the $ 2 $ -nd problem. Radewoosh will get $ 4 $ points for the $ 8 $ -th problem. They won't get points for other problems and thus there is a tie because $ 2+2=4 $ .