题目链接:

A. Bear and Reverse Radewoosh

time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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 order n, 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 thei-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.

Examples
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

题意:

从前到后和从后到前计算,比较大小;

AC代码:
/*
2014300227 658A - 13 GNU C++11 Accepted 15 ms 2280 KB
*/ #include <bits/stdc++.h>
using namespace std;
int n,c;
int p[],t[];
int main()
{
scanf("%d%d",&n,&c);
for(int i=;i<=n;i++)
{
scanf("%d",&p[i]);
}
for(int i=;i<=n;i++)
{
scanf("%d",&t[i]);
}
int x=,y=,ti=,te=;
for(int i=;i<=n;i++)
{
ti+=t[i];
x+=max(,p[i]-c*ti);
}
for(int i=n;i>;i--)
{
te+=t[i];
y+=max(,p[i]-c*te);
}
if(x>y)cout<<"Limak"<<"\n";
else if(x<y)cout<<"Radewoosh"<<"\n";
else cout<<"Tie"<<"\n"; return ;
}

codeforces 658A A. Bear and Reverse Radewoosh(水题)的更多相关文章

  1. VK Cup 2016 - Round 1 (Div. 2 Edition) A. Bear and Reverse Radewoosh 水题

    A. Bear and Reverse Radewoosh 题目连接: http://www.codeforces.com/contest/658/problem/A Description Lima ...

  2. codeforces 680B B. Bear and Finding Criminals(水题)

    题目链接: B. Bear and Finding Criminals //#include <bits/stdc++.h> #include <vector> #includ ...

  3. codeforces 680A A. Bear and Five Cards(水题)

    题目链接: A. Bear and Five Cards //#include <bits/stdc++.h> #include <vector> #include <i ...

  4. codeforces 653A A. Bear and Three Balls(水题)

    题目链接: A. Bear and Three Balls time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  5. VK Cup 2016 - Round 1 (Div. 2 Edition) A Bear and Reverse Radewoosh

    A. Bear and Reverse Radewoosh time limit per test 2 seconds memory limit per test 256 megabytes inpu ...

  6. codeforces Gym 100187L L. Ministry of Truth 水题

    L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...

  7. Codeforces Round #185 (Div. 2) B. Archer 水题

    B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B D ...

  8. Educational Codeforces Round 14 A. Fashion in Berland 水题

    A. Fashion in Berland 题目连接: http://www.codeforces.com/contest/691/problem/A Description According to ...

  9. Codeforces Round #360 (Div. 2) A. Opponents 水题

    A. Opponents 题目连接: http://www.codeforces.com/contest/688/problem/A Description Arya has n opponents ...

随机推荐

  1. Node.js学习笔记(4)——除了HTTP(服务器和客户端)部分

    很多node入门的书里面都会在介绍node特性的时候说:单线程,异步式I/O,事件驱动. Node不是一门语言,它是运行在服务器端的开发平台,官方指定语言为javascript. 阻塞和线程: 线程在 ...

  2. Hibernate demo之使用xml

    1.新建maven项目 testHibernate,pom.xml <?xml version="1.0" encoding="UTF-8"?> & ...

  3. com.opensymphony.xwork2.ognl.OgnlValueStack - Error setting expression 'customer.applyRate' with value '[Ljava.lang.String;@7d3fae2c'

    出错的3个最可能的原因:我是第二种错误 1.action配置错误 <action name="doCreateMeetingInfo" class="meeting ...

  4. andorid中发送短信页面以及邮件发送

    跳转到发送短信页面 Uri smsToUri = Uri.parse("smsto://10086"); Intent mIntent = new Intent( android. ...

  5. PowerBuilder -- Tab控件

    在tab中关闭窗口 Close(tab_1.getparent()) 调整tab中的控件的tab oder 鼠标右键tabpage_1,选择 Tab Order菜单.

  6. Frege-基于JVM的类Haskell纯函数式编程语言

    Frege是一门受Haskell语言启示而设计的纯函数式编程语言.Frege程序会被编译为Java,并执行于JVM上.它与Haskell是如此的类似.以至于有人称它为JVM上的Haskell.取Fre ...

  7. IT痴汉的工作现状10-Sprint Planning

    这是我们的第四个Sprint了.因为上一个迭代周期的失利,Leader群发邮件这样描写叙述道:"对任务的乐观预计,导致Sprint 3没有如期完毕. 我们须要在这次Sprint计划中细致评估 ...

  8. linux 安装mongo

    在Linux中安装Mongodb操作说明 MongoDB配置 版本说明:因本机所装Red Hat 为 64位操作系统故本例以64位的MongDB为例.所用版本如下: (1)    Red Hat En ...

  9. 关于Gradle和Gradle插件的问题

    一.   Gradle更新插件问题 当更新Andorid studio 的时候,你可能会接收到一条让你更新Gradle插件到最新版本的建议.在项目编译需要的基础上,你可以选择接受或者手动选择一个具体的 ...

  10. GS与网络打交道

    与网络打交道 在GS,GC,Share都与网络打交道,但还是GC最多 GC打交道过程 send_stat BaseChannel::SendCmdTry() { if (!m_queCmd.size( ...