CF186B.Growing Mushrooms

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 _t_1 seconds and the second part lasts _t_2 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 v__i meters per second. After _t_1 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 u__i meters per second. After a _t_2 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 a__i and b__i, then there are two strategies: he either uses speed a__i before the break and speed b__i 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).

每年,矮人国王的城堡都会举办一场矮人之间的蘑菇种植比赛。这场比赛是其中最负盛名的比赛之一,获胜者将获得一只木制沙拉碗。今年的比赛汇聚了来自世界各地最优秀的蘑菇种植者,因此我们不得不略微修改规则,以使比赛更具观赏性。

每位蘑菇种植者都拥有一株将在比赛中培育的蘑菇。根据新规则,比赛分为两个阶段:第一阶段持续 t1t_1 秒,第二阶段持续 t2t_2 秒。两个阶段之间有一段短暂的休息时间。

起跑哨声响起后,比赛第一阶段开始,所有蘑菇种植者同时开始培育蘑菇,每人以各自独立的速度 viv_i 米/秒进行培育。经过 t1t_1 秒后,所有蘑菇种植者停止培育并进入休息。在休息期间,由于不明原因,所有蘑菇的生长量均减少 kk%。休息结束后,比赛第二阶段开始,所有蘑菇种植者再次同时继续培育蘑菇,每人以各自独立的速度 uiu_i 米/秒进行培育。再经过 t2t_2 秒后,比赛结束。注意:休息前后的培育速度可能不同。

赛前,矮人帕夏已从所有参赛者处获知他们各自选定的两个速度。然而,参赛者不愿向他透露全部策略,因此并未说明这两个速度的使用顺序。也就是说,若某位参赛者选定了速度 aia_i 和 bib_i,则存在两种策略:他要么在休息前使用速度 aia_i、休息后使用速度 bib_i;要么反之,在休息前使用速度 bib_i、休息后使用速度 aia_i。

矮人帕夏非常渴望赢得总分榜(totalizer)冠军。他知晓每位参赛者都会选择能使蘑菇最终高度最大化的策略。请帮助矮人帕夏生成最终的比赛成绩表。

成绩表按蘑菇最终高度降序排列(蘑菇更高的参赛者排名更靠前);若蘑菇高度相同,则按参赛者编号升序排列(编号更小的参赛者排名更靠前)。

输入格式

The first input line contains four integer numbers n, _t_1, _t_2, k (1 ≤ n, _t_1, _t_2 ≤ 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 a__i, b__i (1 ≤ a__i, b__i ≤ 1000) — the speeds which the participant number i chose.

第一行输入包含四个整数 nn、t1t_1、t2t_2、kk(1≤n,t1,t2≤10001 \leq n, t_1, t_2 \leq 1000;1≤k≤1001 \leq k \leq 100),分别表示参赛者人数、休息前的时间、休息后的时间,以及休息期间蘑菇生长速度下降的百分比。

接下来的 nn 行,每行包含两个整数。第 ii 行(1≤i≤n1 \leq i \leq n)包含两个以空格分隔的整数 aia_i、bib_i(1≤ai,bi≤10001 \leq a_i, b_i \leq 1000),表示第 ii 号参赛者所选择的速度。

输出格式

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.

输出最终结果表格:共 n 行,每行应包含对应小矮人的编号及其蘑菇的最终最大高度(保留小数点后两位)。若答案完全精确,则视为正确。

输入输出样例

  • 输入#1

    2 3 3 50
    2 4
    4 2

    输出#1

    1 15.00
    2 15.00
  • 输入#2

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

    输出#2

    4 1656.07
    1 937.03
    2 379.99
    3 379.99

说明/提示

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

  • 第一个例子:对每位参赛者而言,最优策略是先以速度 2 奔跑,再以速度 4 奔跑,因为 2⋅3⋅0.5+4⋅3>4⋅3⋅0.5+2⋅32\cdot3\cdot0.5 + 4\cdot3 > 4\cdot3\cdot0.5 + 2\cdot3。

输入解题思路,AI测评打分。不知道怎么写?

首页