首页 > 其他分享 >CodeForces - 658A Bear and Reverse Radewoosh (模拟)水

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

时间:2023-06-08 14:03:12浏览次数:90  
标签:Radewoosh Reverse CodeForces Bear Limak ti pi include define

Time Limit: 2000MS

 

Memory Limit: 262144KB

 

64bit IO Format: %I64d & %I64u

CodeForces - 658A


Bear and Reverse Radewoosh



Submit Status




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)

Limak is going to solve problems in order 1, 2, ..., n (sorted increasingly by pi). Radewoosh is going to solve them in ordern, 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






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





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





Source



VK Cup 2016 - Round 1 (Div. 2 Edition)



//题意:输入n,c,接下来n个数p[i],表示第i个题的得分,再输入n个数t[i],表示第i个题的耗时,
给你n道题,c表示每分钟每道题的掉的分数为c,问L正着做完得分高,还是R 倒着做完得分高。
//思路:
直接模拟,不难,但是要注意每道题的得分最小为0(不可能为负数,这是常识,但开始时没考虑,就卡了一会。。。)。




#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#define INF 0x3f3f3f3f
#define ull unsigned lonb long
#define ll long long
#define IN __int64
#define N 1010
#define M 1000000007
using namespace std;
int p[N];
int t[N];
int main()
{
	int n,c;
	int i,j,k;
	while(scanf("%d%d",&n,&c)!=EOF)
	{
		int sum1=0,sum2=0;
		for(i=1;i<=n;i++)
			scanf("%d",&p[i]);
		for(i=1;i<=n;i++)
			scanf("%d",&t[i]);
		k=0;
		for(i=1;i<=n;i++)
		{
			k+=t[i]*c;
			sum1+=max(0,p[i]-k);
		}
		k=0;
		for(i=n;i>=1;i--)
		{
			k+=t[i]*c;
			sum2+=max(0,p[i]-k);
		}
		if(sum1>sum2)
			printf("Limak\n");
		else if(sum1==sum2)
			printf("Tie\n");
		else
			printf("Radewoosh\n");
	}
	return 0;
}





标签:Radewoosh,Reverse,CodeForces,Bear,Limak,ti,pi,include,define
From: https://blog.51cto.com/u_16079508/6439514

相关文章

  • CodeForces - 616B Dinner with Emma (模拟)水
    TimeLimit: 1000MS MemoryLimit: 262144KB 64bitIOFormat: %I64d&%I64uCodeForces-616BDinnerwithEmmaSubmit StatusDescriptionJackdecidestoinviteEmmaoutforadinner.Jackisamodeststudent,hedoesn'twanttogotoanexpensiveres......
  • CodeForces - 659B Qualifying Contest (模拟)水
    TimeLimit: 1000MS MemoryLimit: 262144KB 64bitIOFormat: %I64d&%I64uCodeForces-659BQualifyingContestSubmit StatusDescriptionVerysoonBerlandwillholdaSchoolTeamProgrammingOlympiad.Fromeachofthe m Berlandregionsateamoftwopeo......
  • CodeForces - 670A Holidays (模拟) 水
    TimeLimit: 1000MS MemoryLimit: 262144KB 64bitIOFormat: %I64d&%I64uCodeForces-670AHolidaysSubmit StatusDescriptionOntheplanetMarsayearlastsexactly nInputThefirstlineoftheinputcontainsapositiveinteger n (1 ≤ n ≤ 1 000......
  • Codeforces Round 876 (Div. 2) 题解 A - D
    A.TheGoodArray题目大意给定两个整数\(n\)和\(k\),规定一个\(01\)数列为好的的条件是,对于\(1\simn\)中任意的\(i\),都有:\(a\)的前\(i\)个元素中至少有\(\lceil\frac{i}k\rceil\)个都是\(1\)。\(a\)的后\(i\)个元素中至少有\(\lceil\frac{i}k\rceil\)个都是......
  • codeforces.com/contest/1553/problem/B
    简单字符串哈希题意给一个字符串s和t,问从s的某个位置开始,向右到某个点后再向左,顺序遍历到的字符形成的字符串可否为t。思路数据只有500,\(O(n^3)\)可过,枚举转折点,然后枚举开头和结尾。代码intn,m,k;ullHash[1010],rHash[1010],p[1010],rp[1010],sum;voidsolve(){ ......
  • Codeforces Round 876 (Div. 2) A-D
    比赛地址A.TheGoodArray题意:定义一个数组是good的要求有:从左往右所有的i,前i个数中至少有[i/k]个数是1从右往左所有的i,前i个数中至少有[i/k]个数是1问good数组对于n而言最少需要多少个1Solution先从左往右填1,直到满足第一个条件,然后从右往左填1,直到满足第二个条件voidso......
  • ACM-CodeForces-#685(Div.2)
    A.SubtractorDivide#include<iostream>usingnamespacestd;intmain(){ intT,n; cin>>T; while(T--) { cin>>n; if(n<=3) n--; else n=2+(n&1); cout<<n<<endl; } return0;}B.Non-SubstringSubsequence#in......
  • Codeforces 1566G - Four Vertices(线段树分治)
    交了整整2页,本来想用随机化卡过去的,后来发现我的实现跑得太慢就写正常做法了。首先发现最优答案对应的四个点只可能有以下两种可能:\(a,b\)间有边,\(c,d\)间有边,此时答案是\(a,b\)边权值加\(c,d\)边权值。\(a\)与\(b,c,d\)三个点间都有边,此时答案是三条边权值之和。......
  • Codeforces 1801D The way home
    看到shortestpaths来做的。首先有一个贪心的策略,对于当前点\(u\)若不能直接往后走则肯定是选择经过的点中\(w_i\)最大的加。很好理解,证明就不需要了。所以可以定义状态\(f_{u,mx}\)为\(u\)点最大能加的值为\(h_{mx}\)的最优状态,\(h\)是\(w\)离散化后的数组。......
  • Codeforces 1588F - Jumping Through the Array
    显然无法用polylog的数据结构维护,序列分块也不行,考虑询问分块。每\(B\)个询问处理一次。将这个询问中\(2,3\)操作涉及到的点设为“关键点”,那么容易发现,环上每一段以关键点结尾的链在这块操作的过程中始终保持不变,也就是说我们可以把它们缩在一起。先预处理出每个块的增量......