博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
VK Cup 2016 - Round 1 (Div. 2 Edition) A. Bear and Reverse Radewoosh 水题
阅读量:7124 次
发布时间:2019-06-28

本文共 2408 字,大约阅读时间需要 8 分钟。

A. Bear and Reverse Radewoosh

题目连接:

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 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 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

3 2

50 85 250
10 15 25

Sample Output

Limak

Hint

题意

有两个人在做CF,一个正着做,一个反着做

给你每道题的分值以及每道题做题的时间,问你谁的分数高

题解:

暴力模拟,扫一遍就好了

代码

#include
using namespace std;const int maxn = 55;long long p[maxn];long long t[maxn];int main(){ int n,c; scanf("%d%d",&n,&c); for(int i=1;i<=n;i++)scanf("%lld",&p[i]); for(int i=1;i<=n;i++)scanf("%lld",&t[i]); long long p1 = 0,p2 = 0; long long sum = 0; for(int i=1;i<=n;i++) { sum+=t[i]; p1 = p1 + max(0LL,p[i]-c*sum); } sum=0; for(int i=n;i>=1;i--) { sum+=t[i]; p2 = p2 + max(0LL,p[i]-c*sum); } if(p1>p2)cout<<"Limak"<
p1)cout<<"Radewoosh"<

转载地址:http://fnael.baihongyu.com/

你可能感兴趣的文章
2017年informix小结
查看>>
CentOS下SYN***战
查看>>
微信小程序列表页实现上拉加载下拉刷新
查看>>
算数运算符
查看>>
SDWebImage
查看>>
SELinux深入理解
查看>>
[原创]windows server 2012 AD架构 试验 系列 – 9 AD证书服务
查看>>
node学习----Promise 初见
查看>>
初次使用ubuntu
查看>>
数字证书学习笔记
查看>>
将你的科学计算从Matlab迁移到Python?
查看>>
Python--day8--Socket编程/异常处理
查看>>
你为你的程序做了什么--项目篇
查看>>
烂泥:使用nginx利用虚拟主机搭建WordPress博客
查看>>
烂泥:yum的使用及配置
查看>>
动物会产生“鸡尾酒”模式毒素
查看>>
HashSet和TreeSet的区别
查看>>
白盒1:iOS静态代码扫描
查看>>
什么是商业画布呢?
查看>>
python 之易经启卦
查看>>