题目链接:

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. ubuntu下编译原生ffmpeg

    本文主要介绍Linux 系统下如何编译Ffmpeg,编译环境是Ubuntu 16.04,Ffmpeg版本是3.4.2.Windows环境 下如何编译ffmpeg前面有博文介绍,也录有视频,感兴趣的同学 ...

  2. java自定义before和after

    package com.ada.wuliu.worker.web.cooperation.worker; public class TestOne { abstract class Father{ p ...

  3. IOS-4-面试题1:黑马程序猿IOS面试题大全

    一.多线程网络 1. 多线程的底层实现? 1> 首先搞清楚什么是线程.什么是多线程 2> Mach是第一个以多线程方式处理任务的系统.因此多线程的底层实现机制是基于Mach的线程 3> ...

  4. MySQL 5.7.18的安装及主从复制(主从同步)

    MySQL 5.7.18的安装与主从复制 IP 计算机名 角色 192.168.1.222 001 master 192.168.1.233 002 slave CentOS 6.9安装mysql5. ...

  5. JAVA使用并行流(ParallelStream)时要注意的一些问题

    https://blog.csdn.net/xuxiaoyinliu/article/details/73040808

  6. gitHub静态页面托管

    github已经是众所周知的程序员同性交友网站了,我就不多说了,(+_+)? 下面讲一讲如何在不用自己购买空间域名备案的情况下,通过github来托管自己的一些小demo或者项目 让其能够通过gith ...

  7. 04 redis list结构及命令详解

    一:link 链表结构 lpush key value 作用: 把值插入到链接头部[右边] 注意:rpush key value 插入到左边 rpop key 作用: 返回并删除链表尾元素 rpush ...

  8. Android 手机怎么录屏制成gif图片(电脑录制gif图)

    参考:http://www.cnblogs.com/dasusu/p/4903511.html 上面的博主说的很详细了,但作为学习记录我就重新写一遍帮助自己加深记忆 一.准备条件 1.你搭建了Andr ...

  9. Flyweight Design Pattern 共享元设计模式

    就是利用一个类来完毕多种任务.不用每次都创建一个新类. 个人认为这个设计模式在C++里面,好像能够就使用一个函数取代,利用重复调用这个函数完毕任务和重复利用这个类,好像几乎相同. 只是既然是一个设计模 ...

  10. 【BZOJ4238】电压 DFS树

    [BZOJ4238]电压 Description 你知道Just Odd Inventions社吗?这个公司的业务是“只不过是奇妙的发明(Just Odd Inventions)”.这里简称为JOI社 ...