Bear and Reverse Radewoosh(水)

CPC训练联盟程序设计夏令营(四) Limak 和 Radewoosh 将在即将到来的算法竞赛中相互竞争。他们同样熟练,但不会以相同的顺序解决问题。会有 n 个问题。第 i 个问题的初始得分为 pi,仅需要花费 ti 分钟即可解决。问题按难度排序, 保证 pi<pi + 1 和 ti<ti + 1。常数 c 也被给出,代表了松动点的速度。然后,在时间 x(比赛开始后 x 分钟)提交第 i 个问题,将得到 max(0, pi-c*x)分。Limak 将按 1、2、3、…、n 的顺序解决问题(按 pi 递增)。 阅读详情
Bear and Reverse Radewoosh
Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

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

Sample Input

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

Hint

In the first sample, there are 3 problems. Limak solves them as follows:

  1. Limak spends 10 minutes on the 1-st problem and he gets 50 - c·10 = 50 - 2·10 = 30 points.
  2. Limak spends 15 minutes on the 2-nd problem so he submits it 10 + 15 = 25 minutes after the start of the contest. For the 2-nd problem he gets 85 - 2·25 = 35 points.
  3. He spends 25 minutes on the 3-rd problem so he submits it 10 + 15 + 25 = 50 minutes after the start. For this problem he gets250 - 2·50 = 150 points.

So, Limak got 30 + 35 + 150 = 215 points.

Radewoosh solves problem in the reversed order:

  1. Radewoosh solves 3-rd problem after 25 minutes so he gets 250 - 2·25 = 200 points.
  2. He spends 15 minutes on the 2-nd problem so he submits it 25 + 15 = 40 minutes after the start. He gets 85 - 2·40 = 5 points for this problem.
  3. He spends 10 minutes on the 1-st problem so he submits it 25 + 15 + 10 = 50 minutes after the start. He gets max(0, 50 - 2·50) = max(0,  - 50) = 0 points.

Radewoosh got 200 + 5 + 0 = 205 points in total. Limak has 215 points so Limak wins.

In the second sample, Limak will get 0 points for each problem and Radewoosh will first solve the hardest problem and he will get 250 - 6·25 = 100 points for that. Radewoosh will get 0 points for other two problems but he is the winner anyway.

In the third sample, Limak will get 2 points for the 1-st problem and 2 points for the 2-nd problem. Radewoosh will get 4 points for the8-th problem. They won't get points for other problems and thus there is a tie because 2 + 2 = 4.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
	int n,c;
	while(~scanf("%d%d",&n,&c))
	{
		int point[1010],sore[1010],time[1010],point1[1010];
		memset(point,0,sizeof(point));
		memset(point1,0,sizeof(point1));
		for(int i=1;i<=n;i++)
		scanf("%d",&sore[i]);
		for(int i=1;i<=n;i++)
		scanf("%d",&time[i]);
		int p=0,num=0;
		for(int i=1;i<=n;)
		{
			p=p+time[i];
			point[num++]=max(0,sore[i]-p*c);
			i++;
		}
		int sum1=0;
		for(int i=0;i<num;i++)
	    sum1+=point[i];
	    int s=0,num1=0;
	    for(int i=n;i>=1;)
	    {
	    	s=s+time[i];
			point1[num1++]=max(0,sore[i]-s*c);
			i--;
		}
		int sum2=0;
		for(int i=0;i<num1;i++)
		sum2+=point1[i];
		if(sum1>sum2)
		printf("Limak\n");
		else if(sum1==sum2)
		printf("Tie\n");
		else printf("Radewoosh\n");
	}
	
	return 0;
}

Python头歌实验题目(2024版) 武汉理工大学头歌平台实验题目 阅读详情

相关推荐

别再踩坑了!手把手教你用EB Tresos Studio创建Autosar MCAL工程(含模块配置避坑指南)

本文详细介绍了使用EB Tresos Studio创建Autosar MCAL工程的完整流程,包括工程创建前的关键准备、模块配置的避坑指南以及工程验证与代码生成的实用技巧。通过实战案例和黄金准则,帮助开发者高效完成MCAL工程创建,避免常见错误,提升开发效率。

weixin_42536058的博客 449

【CodeForces】[658A]Bear and Reverse Radewoosh

根据题意分别计算两人的分值 进行比较就好了

BoilTask Talk Show 773

# 芯片良率是怎么算出来的?——从泊松到负二项分布,一个芯片测试工程师的视角

- 良率=好Die/总Die,但选错模型可能差17个百分点 - Poisson模型过于悲观,Murphy居中,**Negative Binomial才是业界标配** - 关键不是良率数字,是**跟踪聚类因子α的变化**——它能早几周预警工艺漂移 - Chiplet时代,10颗90%良率的Die封在一起,整体良率只有35%

Freezeblur的博客 669

Codeforces 658A Bear and Reverse Radewoosh

#define _CRT_SECURE_NO_WARNINGS #include &lt;iostream&gt; #include &lt;cstdio&gt; #include &lt;math.h&gt; #include &lt;string&gt; #include &lt;algorithm&gt; using namespace std; int n, c; int score...

Polanwind 149

详细介绍pytorch重要的API

Tensor 是 PyTorch 中最基本的数据结构,提供了多种创建和操作张量的函数。Autograd 提供了自动求导功能,可以跟踪 Tensor 上的操作并计算梯度。损失函数用于衡量模型预测值与真实值之间的差异,提供了多种损失函数。是构建神经网络的基础类,提供了定义网络层和前向传播的方法。提供了 GPU 计算的支持,包括设备管理、内存管理等。提供了一些常用的函数式操作,如激活函数、损失函数等。提供了常用的数据集、模型架构和图像转换工具。提供了数据加载和预处理的工具,包括。

hello! 1224

Codeforces 658A Bear and Reverse Radewoosh 【水题】

题目链接:Codeforces 658A Bear and Reverse Radewoosh A. Bear and Reverse Radewoosh time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Limak and

世界很大 594

小米路由器安装Misstar tools 和MIXBOX

1.该教程适用于如下路由器: 小米路由器1代硬盘版(R1D) 小米路由器mini(R1CM) 全新小米路由器硬盘版(R2D) 小米路由器3(R3) 小米路由器3G(R3G) 小米路由器Pro(R3P) 小米路由器HD(R3D) 2.Misstar2.0在线安装 方法如下: 1.根据路由器对应文件解压文件,把解压目录(比如小米3路由器为R3)和offline_install.sh到U盘根目录,并插入路由器 2.ssh登录后,cd到U盘的目录,比如小米3路...

wybarcelona的博客 2万+

程序设计入门竞赛

然后,求d的时候不要掉进坑以为最小的差值就是公差 No!要是最小数值刚好是公差两倍不就错了是吧,所以这个时候就要求各个值之间的最大公因数!懂了吧,这才是本题解题的关键。这道题首先要知道求等差数列的公式。难绷,掉坑里了QAQ。

weixin_63914060的博客 1003

【嘉立创EDA】PCB金属包边设计快捷方法

本文使用嘉立创EDA,描述如何在PCB设计时,快速增加边框包边设计,特别是金属包边(伪)——这里标记(伪)是因为该这里的包边特指不含边缘壁。请参考本文时特别注意!本文将此过程记录,以供有需要的读者参考。

l64481000的博客 1770

GRCNN抓取网络学习2【自制Jacquard数据集训练】

请先完成【机械臂视觉抓取从理论到实战】,这样有利于下面操作的理解!然后第二步是GRCNN抓取网络1【Jacquard数据集等效抓取集制作】,有了自己的数据集输入到GRCNN中是三种文件,接下来就是准备训练GRCNN网络啦!grasps.txtRGB.png本文帮大家根据自制Jacquard数据集训练GRCNN抓取网络,其中包含数据格式的对齐,列举了常见的几种训练方法,相信能坚持到这里的都应该试试顺利了吧!接下来会针对GRCNN调优,期待一下下吧,那就别宁色你的三连。

vor234的博客 2804

CodeForces - 658A Bear and Reverse Radewoosh (模拟)水

CodeForces - 658A Bear and Reverse Radewoosh Time Limit: 2000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Limak and Radewoosh

yanghui07216的博客 640

RT-DETR改进目录一览 | 涉及卷积层、轻量化、注意力、损失函数、Backbone、SPPF、Neck、检测头等全方位改进

1️⃣本专栏已更新260多种不同的改进方法,所使用并改进的每一个模块均包含详细的模块分析、原理讲解、个人总结、多种改进方式以及完整的修改流程,所有改进100%可直接运行。2️⃣所有改进点均为近三年顶会,顶刊提出的先进算法,将其融入到中,紧跟学术热点,适应不同的任务场景。3️⃣团队内发表数篇SCI论文,熟悉完整的发表流程,订阅专栏即可进群享受模型训练、模型改进、论文写作、投稿选刊,从入门到论文的各种答疑内容。4️⃣专栏内容会持续更新,最近更新时间:2024-12-4。项目介绍在大家购买专栏后,加入学习

Limiiiing的博客 2万+

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

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 Limak and Radewoosh are going to compete against each other in the upcoming algorithmic contest. They ar...

weixin_34090562的博客 133

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

【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 input standard input output standard output Limak and Radewoosh are going

snowy_smile的博客 702

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

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

zhaoluwei的博客 324

A. Bear and Reverse Radewoosh

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

人间烟火气,最抚凡人心 434

【codeforces】 Bear and Reverse Radewoosh

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

better_space的博客 287

【codeforces 658A Bear and Reverse Radewoosh】

Bear and Reverse RadewooshDescription 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 sam

楚江枫 444

Codeforces--658A--Bear and Reverse Radewoosh(模拟)

Bear and Reverse Radewoosh Time Limit: 2000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Limak and Radewoosh are going to compete

playboy307 448

CodeForces 658A Bear and Reverse Radewoosh(模拟)

http://codeforces.com/problemset/problem/658/A A. Bear and Reverse Radewoosh time limit per test 2 seconds memory limit per test 256 megabytes input standard input output

Shyazhut 460

Codeforces 658A Bear and Reverse Radewoosh

题目:http://codeforces.com/problemset/problem/658/A 代码: #include #include #include using namespace std; int main() { int n,c; scanf("%d%d",&n,&c); int a[55]= {0},b[55]= {0}; int ans1

Pig_Me的博客 342

CodeForces 658A Bear and Reverse Radewoosh

Bear and Reverse Radewoosh Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description Limak and Radewoosh are going to compete against each other in the upcomin

梦❤梦的博客 236
上一篇: 【南阳1261】河南多校训练
下一篇: Co-prime Array
idealistic
博客等级 码龄10年 97粉丝 395原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值