CF658A.Bear and Reverse Radewoosh

普及/提高-

通过率:0%

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 nn problems. The ii -th problem has initial score pip_{i} and it takes exactly tit_{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 cc is given too, representing the speed of loosing points. Then, submitting the ii -th problem at time xx ( xx minutes after the start of the contest) gives max(0, picx)max(0,\ p_{i}-c·x) points.

Limak is going to solve problems in order 1,2,...,n1,2,...,n (sorted increasingly by pip_{i} ). Radewoosh is going to solve them in order n,n1,...,1n,n-1,...,1 (sorted decreasingly by pip_{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 tit_{i} . That means both Limak and Radewoosh will accept all nn problems.

输入格式

The first line contains two integers nn and cc ( 1<=n<=50,1<=c<=10001<=n<=50,1<=c<=1000 ) — the number of problems and the constant representing the speed of loosing points.

The second line contains nn integers p1,p2,...,pnp_{1},p_{2},...,p_{n} ( 1<=p_{i}<=1000,p_{i}<p_{i+1} ) — initial scores.

The third line contains nn integers t1,t2,...,tnt_{1},t_{2},...,t_{n} ( 1<=t_{i}<=1000,t_{i}<t_{i+1} ) where tit_{i} denotes the number of minutes one needs to solve the ii -th problem.

输出格式

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.

输入输出样例

  • 输入#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 33 problems. Limak solves them as follows:

  1. Limak spends 1010 minutes on the 11 -st problem and he gets 50c10=50210=3050-c·10=50-2·10=30 points.
  2. Limak spends 1515 minutes on the 22 -nd problem so he submits it 10+15=2510+15=25 minutes after the start of the contest. For the 22 -nd problem he gets 85225=3585-2·25=35 points.
  3. He spends 2525 minutes on the 33 -rd problem so he submits it 10+15+25=5010+15+25=50 minutes after the start. For this problem he gets 250250=150250-2·50=150 points.

So, Limak got 30+35+150=21530+35+150=215 points.

Radewoosh solves problem in the reversed order:

  1. Radewoosh solves 33 -rd problem after 2525 minutes so he gets 250225=200250-2·25=200 points.
  2. He spends 1515 minutes on the 22 -nd problem so he submits it 25+15=4025+15=40 minutes after the start. He gets 85240=585-2·40=5 points for this problem.
  3. He spends 1010 minutes on the 11 -st problem so he submits it 25+15+10=5025+15+10=50 minutes after the start. He gets max(0,50250)=max(0,50)=0max(0,50-2·50)=max(0,-50)=0 points.

Radewoosh got 200+5+0=205200+5+0=205 points in total. Limak has 215215 points so Limak wins.

In the second sample, Limak will get 00 points for each problem and Radewoosh will first solve the hardest problem and he will get 250625=100250-6·25=100 points for that. Radewoosh will get 00 points for other two problems but he is the winner anyway.

In the third sample, Limak will get 22 points for the 11 -st problem and 22 points for the 22 -nd problem. Radewoosh will get 44 points for the 88 -th problem. They won't get points for other problems and thus there is a tie because 2+2=42+2=4 .

首页