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 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 水题的更多相关文章
- 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 ...
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) A. Little Artem and Presents 水题
A. Little Artem and Presents 题目连接: http://www.codeforces.com/contest/669/problem/A Description Littl ...
- VK Cup 2016 - Round 1 (Div. 2 Edition) C. Bear and Forgotten Tree 3
C. Bear and Forgotten Tree 3 time limit per test 2 seconds memory limit per test 256 megabytes input ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) D Bear and Two Paths
题目链接: http://codeforces.com/contest/673/problem/D 题意: 给四个不同点a,b,c,d,求是否能构造出两条哈密顿通路,一条a到b,一条c到d. 题解: ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) C - Bear and Colors
题目链接: http://codeforces.com/contest/673/problem/C 题解: 枚举所有的区间,维护一下每种颜色出现的次数,记录一下出现最多且最小的就可以了. 暴力n*n. ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) D. Bear and Two Paths 构造
D. Bear and Two Paths 题目连接: http://www.codeforces.com/contest/673/problem/D Description Bearland has ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) C. Bear and Colors 暴力
C. Bear and Colors 题目连接: http://www.codeforces.com/contest/673/problem/C Description Bear Limak has ...
- 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 ...
- 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 ...
随机推荐
- 关于[神州数码信息安全DCN杯/信息安全管理与评估]的一些经验之谈
前阵子参加了神州数码的比赛,赛后有如下经验分享,给还没参加过的朋友分享一下心德以及要注意的坑. 先科普一下这个比赛的三个阶段: 第一阶段主要是考网络部分的,例如搭建wifi以及防火墙诸如此类的设备. ...
- 千字短文解决工程师们关于SPI的迷糊!
串行外设接口 (SPI) 总线是一个工作在全双工模式下的同步串行数据链路.它可用于在单个主控制器和一个或多个从设备之间交换数据.其简单的实施方案只使用四条支持数据与控制的信号线(图 1): 图1:基本 ...
- 判断Selenium加载完成
How do you make Selenium 2.0 wait for the page to load? You can also check pageloaded using followin ...
- Java Eclipse 配置
1.清除多余记录 最近用eclipse打包jar的时候,需要指定一个main函数.需要先运行一下main函数,eclipse的Runnable JAR File Specification 下的Lau ...
- 打开exls表格时报‘向程序发送命令是出现问题’的错误的解决方法
1.问题现象 打开表格文件时系统报如下错误 2.解决方法 1)按照如下方法找到excel选项,点击进入 2)找到‘忽略使用动态数据交换(DDE)的其它应用程序(O)',去掉复选框种的勾,点击确定,重新 ...
- Java 序列化工具类
import org.slf4j.Logger; import org.slf4j.LoggerFactory; import sun.misc.BASE64Decoder; import sun.m ...
- Zabbix3.0 API调用
Zabbix API 是什么? API简单来说是服务对外开放的一个接口,用户通过该接口传递请求,完成操作.API的背后是一组方法的集合,这些方法实现了服务对应的不同功能,调用API实际上就是换了一种方 ...
- HDU 3342 Legal or Not(拓扑排序判断成环)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3342 题目大意:n个点,m条有向边,让你判断是否有环. 解题思路:裸题,用dfs版的拓扑排序直接套用即 ...
- [Spring Data JPA问题]Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException
JPQL如下: @Modifying(clearAutomatically = true) @Query("UPDATE SyncTestFromTKDO SET stuAns = '' w ...
- Remove Duplicates from Sorted Array I&&II——怎样防超时
Given a sorted array, remove the duplicates in place such that each element appear only once and ret ...