题目:http://codeforces.com/contest/186/problem/B

B. Growing Mushrooms
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Each year in the castle of Dwarven King there is a competition in growing mushrooms among the dwarves. The competition is one of the most prestigious ones, and the winner gets a wooden salad bowl. This year's event brought together the best mushroom growers from around the world, so we had to slightly change the rules so that the event gets more interesting to watch.

Each mushroom grower has a mushroom that he will grow on the competition. Under the new rules, the competition consists of two parts. The first part lasts t1 seconds and the second part lasts t2 seconds. The first and the second part are separated by a little break.

After the starting whistle the first part of the contest starts, and all mushroom growers start growing mushrooms at once, each at his individual speed of vi meters per second. After t1 seconds, the mushroom growers stop growing mushrooms and go to have a break. During the break, for unexplained reasons, the growth of all mushrooms is reduced by k percent. After the break the second part of the contest starts and all mushrooms growers at the same time continue to grow mushrooms, each at his individual speed of ui meters per second. After a t2 seconds after the end of the break, the competition ends. Note that the speeds before and after the break may vary.

Before the match dwarf Pasha learned from all participants, what two speeds they have chosen. However, the participants did not want to disclose to him all their strategy and therefore, did not say in what order they will be using these speeds. That is, if a participant chose speeds ai and bi, then there are two strategies: he either uses speed ai before the break and speed bi after it, or vice versa.

Dwarf Pasha really wants to win the totalizer. He knows that each participant chooses the strategy that maximizes the height of the mushroom. Help Dwarf Pasha make the final table of competition results.

The participants are sorted in the result table by the mushroom height (the participants with higher mushrooms follow earlier in the table). In case of equal mushroom heights, the participants are sorted by their numbers (the participants with a smaller number follow earlier).

Input

The first input line contains four integer numbers nt1, t2, k (1 ≤ n, t1, t2 ≤ 1000; 1 ≤ k ≤ 100) — the number of participants, the time before the break, the time after the break and the percentage, by which the mushroom growth drops during the break, correspondingly.

Each of the following n lines contains two integers. The i-th (1 ≤ i ≤ n) line contains space-separated integers aibi (1 ≤ ai, bi ≤ 1000)— the speeds which the participant number i chose.

Output

Print the final results' table: n lines, each line should contain the number of the corresponding dwarf and the final maximum height of his mushroom with exactly two digits after the decimal point. The answer will be considered correct if it is absolutely accurate.

Examples
input
2 3 3 50
2 4
4 2

output
1 15.00
2 15.00

input
4 1 1 1
544 397
280 101
280 101
693 970

output
4 1656.07
1 937.03
2 379.99
3 379.99

Note
  • First example: for each contestant it is optimal to use firstly speed 2 and afterwards speed 4, because2·3·0.5 + 4·3 > 4·3·0.5 + 2·3.

看懂题意是关键,题目本身并不难

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <algorithm>
using namespace std;const int maxn = 1e5+5;
int main()
{pair<int,int> s[1000];int n,t1,t2,a,b,k;scanf("%d %d %d %d",&n,&t1,&t2,&k);for(int i=0;i<n;i++){scanf("%d %d",&a,&b);s[i]=make_pair(-max(a*t1*(100-k)+b*t2*100,b*t1*(100-k)+a*t2*100),i+1);}sort(s,s+n);for(int i=0;i<n;i++) printf("%d %.2f\n",s[i].second,-0.01*s[i].first);return 0;
}

Growing Mushrooms相关推荐

  1. cf Educational Codeforces Round 48 C. Vasya And The Mushrooms

    原题: C. Vasya And The Mushrooms time limit per test2 seconds memory limit per test256 megabytes input ...

  2. 用有效的测试培养工程——《Growing Object-Oriented Software, Guided by Tests》读后感

    这本书2009年10月就出来了,当时没来得及细看,只是把它放入了我的待读列表中.后来查到2010年8月也出了中文版,书名叫<测试驱动的面向对象软件开发>.看完全书后,我发现本书重点谈的还是 ...

  3. PCL学习笔记,区域生长分割(region growing segmentation)

    在本博文中,我主要介绍如何在pcl::RegionGrowing类中调用区域增长算法.首先注意一点,这里是region growing segmentation,不是color-based regio ...

  4. ML之LoRDTRF:基于LoRDT(CART)RF算法对mushrooms蘑菇数据集(22+1,6513+1611)训练来预测蘑菇是否毒性(二分类预测)

    ML之LoR&DT&RF:基于LoR&DT(CART)&RF算法对mushrooms蘑菇数据集(22+1,6513+1611)训练来预测蘑菇是否毒性(二分类预测) 目录 ...

  5. AGC024E - Sequence Growing Hard

    AGC024E - Sequence Growing Hard 题目描述 Solution 我们可以把问题看成如下形式: 你有一个空序列,每次要加入一个元素xxx,x∈[1,k]x \in [1,k] ...

  6. PROGRESSIVE GROWING OF GANS FOR IMPROVED QUALITY, STABILITY, AND VARIATION(PGGAN)

    PROGRESSIVE GROWING OF GANS FOR IMPROVED QUALITY, STABILITY, AND VARIATION(PGGAN) 论文简述 论文要点 论文背景 渐进式 ...

  7. Daily Growing 的歌词

    The trees they grow high, and the leaves they do grow green, Many is the time my true love I/'ve see ...

  8. CodeForces-1016C Vasya And The Mushrooms(模拟+思维+前缀和的前缀和) 解题报告 Apare_xzc

    CodeForces-1016C Vasya And The Mushrooms(模拟+思维+二重前缀和 ) 解题报告 xzc 2019/4/7 这周周赛的C题:wyt学姐的恶意   这道题周赛的时候 ...

  9. DeFi保险协议InsurAce.io宣布与Mushrooms Finance达成战略合作为其平台用户提供智能合约安全相关保险服务

    DeFi保险协议InsurAce.io宣布与Mushrooms Finance达成战略合作为其平台用户提供智能合约安全相关保险服务,以保护用户资产免受智能合约漏洞的影响. Mushrooms Fina ...

  10. PROGRESSIVE GROWING OF GANS FOR IMPROVED QUALITY, STABILITY, AND VARIATION

    一些名词 unprecedented前所未有的 inception初始的 autoregressive自回归 hybrid混合 synchrony同步的 prone易于 deviate偏离 摘要 描述 ...

最新文章

  1. 深入JDK源码,这里总有你不知道的知识点!
  2. 初创企业股权架构_初创企业如何以每月不到200美元的价格利用生产级基础架构...
  3. 技术19期:1分钟入门数据治理!必看!【技术篇】
  4. java class 生成对象_Java反射机制(创建Class对象的三种方式)
  5. SQL Server会话KILL不掉,一直处于KILLED /ROLLBACK状态情形浅析
  6. 在南京 学计算机 高职学校,2018南京专科学校有哪些 最新高职院校名单
  7. 实验4 贪心法(作业调度问题)
  8. 关于IIS 7.5 限制连接数与流量限制模块
  9. Oracle/MySQL/PostgreSQL考题等你挑战(附假期活动获奖名单)
  10. 很想去摆地摊,可是不知道怎么开始,前期需要做什么准备工作吗?
  11. python网络爬虫学习笔记(一):网页基础
  12. Eclipse用法和技巧九:自动添加try/catch块2
  13. 现代通信原理4.2:随机过程
  14. TOGAF ADM指导
  15. win10共享计算机win7,win7和win10共享文件怎么设置_win10和win7建立局域网共享操作方法...
  16. 疫情期间,找工作的一些建议
  17. 什么邮箱垃圾邮件少?邮箱反垃圾系统是什么?
  18. 求出其中最大的元素值,以及其所在的行号和列号。
  19. java基于Springboot餐厅点餐系统-计算机毕业设计
  20. VSC学习前端,不容错过的插件

热门文章

  1. 抖音小程序开发教程之 01 构建开发环境(教程含源码)
  2. Qt QML 模块化管理(三)—— qmldir的化繁为简
  3. phpstorm php代码补全,基本代码补全:补全名称和关键字
  4. 希捷硬盘无法连接计算机,新买的希捷1T移动硬盘在电脑上没法识别
  5. 从苹果封杀Epic与特斯拉硬刚拼多多看新时代的渠道产品战
  6. 0基础学HTML,从快捷方式(IntelliJ IDEA)入手,一步步就能看懂了!
  7. ubuntu16.04系统安装nvidia显卡驱动
  8. TeXmacs对中文的支持
  9. 洛谷 P3332 BZOJ 3110 [ZJOI2013]K大数查询
  10. 联想电脑如何打开BIOS并开启虚拟化——以G50为例