CF658A.Bear and Reverse Radewoosh
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Limak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They are equally skilled but they won't solve problems in the same order.
There will be n problems. The i-th problem has initial score p__i and it takes exactly t__i minutes to solve it. Problems are sorted by difficulty — it's guaranteed that p__i < p__i + 1 and t__i < t__i + 1.
A constant c is given too, representing the speed of loosing points. Then, submitting the i-th problem at time x (x minutes after the start of the contest) gives max(0, p__i - c·x) points.
Limak is going to solve problems in order 1, 2, ..., n (sorted increasingly by p__i). Radewoosh is going to solve them in order n, n - 1, ..., 1 (sorted decreasingly by p__i). Your task is to predict the outcome — print the name of the winner (person who gets more points at the end) or a word "Tie" in case of a tie.
You may assume that the duration of the competition is greater or equal than the sum of all t__i. That means both Limak and Radewoosh will accept all n problems.
Limak 和 Radewoosh 将在即将到来的算法竞赛中相互较量。他们的实力相当,但解题顺序不同。
比赛共有 n 道题目。第 i 道题的初始分数为 pi,恰好需要 ti 分钟解决。题目按难度排序——保证满足 pi<pi+1 且 ti<ti+1。
另给定一个常数 c,表示扣分速度。若在时间 x(即比赛开始后 x 分钟)提交第 i 道题,则获得 max(0,pi−c⋅x) 分。
Limak 将按顺序 1,2,…,n(即按 pi 升序)解题;Radewoosh 将按顺序 n,n−1,…,1(即按 pi 降序)解题。你的任务是预测比赛结果——输出获胜者(最终得分更高者)的名字,若平局则输出 "Tie"。
你可以假设比赛总时长不小于所有 ti 的总和。这意味着 Limak 和 Radewoosh 都能成功提交全部 n 道题。
输入格式
The first line contains two integers n and c (1 ≤ n ≤ 50, 1 ≤ c ≤ 1000) — the number of problems and the constant representing the speed of loosing points.
The second line contains n integers _p_1, _p_2, ..., p__n (1 ≤ p__i ≤ 1000, p__i < p__i + 1) — initial scores.
The third line contains n integers _t_1, _t_2, ..., t__n (1 ≤ t__i ≤ 1000, t__i < t__i + 1) where t__i denotes the number of minutes one needs to solve the i-th problem.
第一行包含两个整数 n 和 c(1 ≤ n ≤ 50,1 ≤ c ≤ 1000)—— 分别表示题目数量和失分速度常数。
第二行包含 n 个整数 p1, p2, ..., pn(1 ≤ pi ≤ 1000,且 pi < pi+1)—— 表示各题的初始分值。
第三行包含 n 个整数 t1, t2, ..., tn(1 ≤ ti ≤ 1000,且 ti < ti+1),其中 ti 表示解决第 i 题所需的时间(单位:分钟)。
输出格式
Print "Limak" (without quotes) if Limak will get more points in total. Print "Radewoosh" (without quotes) if Radewoosh will get more points in total. Print "Tie" (without quotes) if Limak and Radewoosh will get the same total number of points.
如果Limak的总得分更高,则输出 "Limak"(不带引号);
如果Radewoosh的总得分更高,则输出 "Radewoosh"(不带引号);
如果Limak和Radewoosh的总得分相同,则输出 "Tie"(不带引号)。
输入输出样例
输入#1
3 2 50 85 250 10 15 25
输出#1
Limak
输入#2
3 6 50 85 250 10 15 25
输出#2
Radewoosh
输入#3
8 1 10 20 30 40 50 60 70 80 8 10 58 63 71 72 75 76
输出#3
Tie
说明/提示
In the first sample, there are 3 problems. Limak solves them as follows:
- Limak spends 10 minutes on the 1-st problem and he gets 50 - c·10 = 50 - 2·10 = 30 points.
- 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.
- 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:
- Radewoosh solves 3-rd problem after 25 minutes so he gets 250 - 2·25 = 200 points.
- 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.
- 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.
在第一个样例中,共有 3 道题目。Limak 的解题过程如下:
- Limak 在第 1 题上花费了 10 分钟,因此获得 50−c⋅10=50−2⋅10=30 分。
- Limak 在第 2 题上花费了 15 分钟,因此他在比赛开始后 10+15=25 分钟提交该题。对于第 2 题,他获得 85−2⋅25=35 分。
- 他在第 3 题上花费了 25 分钟,因此他在比赛开始后 10+15+25=50 分钟提交该题。对于该题,他获得 250−2⋅50=150 分。
因此,Limak 总共获得 30+35+150=215 分。
Radewoosh 按相反顺序解题:
- Radewoosh 在 25 分钟后解出第 3 题,因此获得 250−2⋅25=200 分。
- 他在第 2 题上花费了 15 分钟,因此他在比赛开始后 25+15=40 分钟提交该题。他为此题获得 85−2⋅40=5 分。
- 他在第 1 题上花费了 10 分钟,因此他在比赛开始后 25+15+10=50 分钟提交该题。他为此题获得 max(0,50−2⋅50)=max(0,−50)=0 分。
Radewoosh 总共获得 200+5+0=205 分。Limak 获得 215 分,因此 Limak 获胜。
在第二个样例中,Limak 每道题均得 0 分;而 Radewoosh 先解最难的题目,并为此获得 250−6⋅25=100 分;其余两题他均得 0 分,但他仍为获胜者。
在第三个样例中,Limak 第 1 题得 2 分,第 2 题也得 2 分;Radewoosh 第 8 题得 4 分;其余题目双方均未得分,因此总分相同(2+2=4),结果为平局。
输入解题思路,AI测评打分。不知道怎么写?