CodeForces - 658A Bear and Reverse Radewoosh (模拟)水

CodeForces - 658A
Bear and Reverse Radewoosh
Time Limit: 2000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u

Submit Status

Description

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 pi and it takes exactly ti minutes to solve it. Problems are sorted by difficulty — it's guaranteed that pi < pi + 1 and ti < ti + 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,  pi - c·x) points.

Limak is going to solve problems in order 1, 2, ..., n (sorted increasingly by pi). Radewoosh is going to solve them in ordern, n - 1, ..., 1 (sorted decreasingly by pi). 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 ti. That means both Limak and Radewoosh will accept all n problems.

Input

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 p1, p2, ..., pn (1 ≤ pi ≤ 1000, pi < pi + 1) — initial scores.

The third line contains n integers t1, t2, ..., tn (1 ≤ ti ≤ 1000, ti < ti + 1) where ti denotes the number of minutes one needs to solve the i-th problem.

Output

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.

Sample Input

Input
3 2 
50 85 250 
10 15 25 
Output
Limak 
Input
3 6
50 85 250 
10 15 25 
Output
Radewoosh 
Input
8 1 
10 20 30 40 50 60 70 80 
8 10 58 63 71 72 75 76 
Output
Tie 

Source

VK Cup 2016 - Round 1 (Div. 2 Edition)
//题意:输入n,c,接下来n个数p[i],表示第i个题的得分,再输入n个数t[i],表示第i个题的耗时,
给你n道题,c表示每分钟每道题的掉的分数为c,问L正着做完得分高,还是R 倒着做完得分高。
//思路:
直接模拟,不难,但是要注意每道题的得分最小为0(不可能为负数,这是常识,但开始时没考虑,就卡了一会。。。)。
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#define INF 0x3f3f3f3f
#define ull unsigned lonb long
#define ll long long
#define IN __int64
#define N 1010
#define M 1000000007
using namespace std;
int p[N];
int t[N];
int main()
{
	int n,c;
	int i,j,k;
	while(scanf("%d%d",&n,&c)!=EOF)
	{
		int sum1=0,sum2=0;
		for(i=1;i<=n;i++)
			scanf("%d",&p[i]);
		for(i=1;i<=n;i++)
			scanf("%d",&t[i]);
		k=0;
		for(i=1;i<=n;i++)
		{
			k+=t[i]*c;
			sum1+=max(0,p[i]-k);
		}
		k=0;
		for(i=n;i>=1;i--)
		{
			k+=t[i]*c;
			sum2+=max(0,p[i]-k);
		}
		if(sum1>sum2)
			printf("Limak\n");
		else if(sum1==sum2)
			printf("Tie\n");
		else
			printf("Radewoosh\n");
	}
	return 0;
}


你可能感兴趣的:(CodeForces - 658A Bear and Reverse Radewoosh (模拟)水)