A. Bear and Reverse Radewoosh

题目连接:

http://www.codeforces.com/contest/658/problem/A

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<bits/stdc++.h>
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"<<endl;else if(p2>p1)cout<<"Radewoosh"<<endl;else cout<<"Tie"<<endl;
}

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

  1. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) B. Little Artem and Grasshopper 模拟题...

    B. Little Artem and Grasshopper 题目连接: http://www.codeforces.com/contest/669/problem/B Description Li ...

  2. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) A. Bear and Game 水题

    A. Bear and Game 题目连接: http://www.codeforces.com/contest/673/problem/A Description Bear Limak likes ...

  3. VK Cup 2016 - Round 1 (Div. 2 Edition) D. Bear and Polynomials

    D. Bear and Polynomials 题目连接: http://www.codeforces.com/contest/658/problem/D Description Limak is a ...

  4. Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance 模拟

    D. Little Artem and Dance 题目连接: http://www.codeforces.com/contest/669/problem/D Description Little A ...

  5. 【VK Cup 2016 - Round 1 (Div 2 Edition)C】【构造】Bear and Forgotten Tree 3 构造一棵树直径为d且点1的深度为h

    Bear and Forgotten Tree 3 time limit per test 2 seconds memory limit per test 256 megabytes input st ...

  6. 【打CF,学算法——二星级】Codeforces Round #313 (Div. 2) B. Gerald is into Art(水题)...

    [CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/B 题面: B. Gerald is into Art time limit per t ...

  7. Codeforces Round #343 (Div. 2) A. Far Relative’s Birthday Cake 水题

    A. Far Relative's Birthday Cake 题目连接: http://www.codeforces.com/contest/629/problem/A Description Do ...

  8. Codeforces Round #590 (Div. 3) F. Yet Another Substring Reverse 子集dp

    传送门 文章目录 题意: 思路: 题意: 思路: 之前做过类似的题,翻转一个字串相当于将任意两个不相交的串连在一起.再一看字符集≤20\le20≤20,那就是铁子集dpdpdp了. 定义f[i]f[i ...

  9. Codeforces Round #477 (rated, Div. 2, based on VK Cup 2018 Round 3)

    点击打开A题链接 #include<bits/stdc++.h> using namespace std; const int MAX = 105; int n,s;int h[MAX], ...

最新文章

  1. 神州数码使用telnet方式管理交换机
  2. redis的五种存储类型的具体用法
  3. coming music shows
  4. 黑马程序员——Java集合基础知识之Map
  5. mysql主键异常(冲突)
  6. response 中OutputStream和PrintWriter区别
  7. ajax请求携带tooken_Spring Boot+Vue 文件上传,如何携带令牌信息?
  8. _tkinter.TclError: no display name and no $DISPLAY environment variable
  9. 关键2招提升软件开发项目的利润
  10. php获取文件夹下指定文件名_VBA和Python对对碰,获取文件名称(含子文件夹)
  11. matlab tiff 压缩方式,无法打开以这种方式压缩的tiff文件(2) - imageJ / FIJI
  12. android 魅族手机bug多,魅族Flyme出现大面积Bug
  13. 工作第一年的所见所闻所学所想
  14. 解方程(equation)
  15. 三坐标检测之精密零件测量的恒温时间
  16. [WDS]Disconnected!
  17. Spring+SpringMVC+Mybatis(开发必备技能)04、mybatis自动生成mapper_dao_model(包含工具与视频讲解) 纯绿色版本、配套使用视频,100%运行成功
  18. BIM轻量化技术解析
  19. MII接口详解【转】
  20. node.js安装步骤

热门文章

  1. 科大讯飞携手华南理工,成立脑机接口公司,注册资本4000万
  2. 亚马逊狂发智能硬件新品:全新音箱、微波炉、挂钟、家庭卫士
  3. 毕啸南专栏 | 对话周鸿祎:打好人工智能时代安全攻防战
  4. Groq新进展!谷歌TPU原班人马明年发布首款AI芯片
  5. Ubuntu18.10与windows7文件夹共享
  6. 记一次微信H5全屏播放视频的总结
  7. 如何在Swiper内制作CSS3动画效果
  8. Python数据可视化1.5 可视化图像
  9. Spring MVC 接收json自动转换JSONObject
  10. WebService优点和缺点小结