题目链接:

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. 生成二维码(jquery.qrcode.min.js插件)

    生成二维码:参看GitHub资源https://github.com/jeromeetienne/jquery-qrcode 直接上代码:(都需要引入jQuery.js  1.引入(jquery.qr ...

  2. Flash威胁的不不过浏览器

    Adobe为提升Flash的安全性.在最新版本号的Flash(18.0.0.209)增加了很多攻击缓解技术. 新的攻击缓解技术为: l  <*>长度验证–添加长度cookie到Vector ...

  3. Mysql或者Hive数据行变成列

    对于mysql /  hive 再进行统计的时候假设须要行变成列,能够使用函数 CASE 字段a WHEN 值b THEN c [WHEN d THEN e]* [ELSE f] END 当字段a=值 ...

  4. ngui 输入事件处理

    NGUI不仅提供了图形接口,还提供了输入事件接口!事件接口是通过UICamera来实现的. Unity3d 为我们提供的原装的input尽管非常方便,但真正跨平台使用时(尤其是跨手机与Pc机时)仍然不 ...

  5. ubuntu16.04下Cmake学习一

    根据网上的资料,我总结了一下,一个工程应该有根目录(bin)存放可执行文件,头文件目录(include)存放头文件,源码文件(src)存放你的算法,还需要一个库文件夹存放你编译的静态库或者动态库.然后 ...

  6. Spring Cloud Zuul API服务网关之请求路由

    目录 一.Zuul 介绍 二.构建Spring Cloud Zuul网关 构建网关 请求路由 请求过滤 三.路由详解 一.Zuul 介绍 ​ 通过前几篇文章的介绍,我们了解了Spring Cloud ...

  7. 还需要学习的十二种CSS选择器

    在前面的文章中,我们在介绍了<五种你必须彻底了解的CSS选择器>,现在向大家介绍,还需要学习的另外十二种CSS选择器.如果你还没有用过,就好好学习一下,如果你已经熟知了就当是温习. 一.X ...

  8. 宜人贷PaaS数据服务平台Genie:技术架构及功能

    上篇:架构及组件 一.数据平台的发展 1.1 背景介绍 随着数据时代的到来,数据量和数据复杂度的增加推动了数据工程领域的快速发展.为了满足各类数据获取/计算等需求,业内涌现出了诸多解决方案.但大部分方 ...

  9. spark on yarn 配置history server

    spark在yarn模式下配置history server 1.建立hdfs文件– hadoop fs -mkdir /user/spark– hadoop fs -mkdir /user/spark ...

  10. Centos 7.0设置静态IP

    1.查看NetworkManager.service systemctl | grep "NetworkManager.service" 2.停止NetworkManager.se ...