Codeforces Round 118 (Div. 2)
B
Growing Mushrooms
Codeforces
1200
原题
← AC →
翻译中…

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

翻译中…

Input

翻译中…

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.

翻译中…

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.

翻译中…

Note

翻译中…
  • 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$.
翻译中…

样例

Input #1
2 3 3 50
2 4
4 2
Output #1
1 15.00
2 15.00
InputCopy OutputCopy
Input #2
4 1 1 1
544 397
280 101
280 101
693 970
Output #2
4 1656.07
1 937.03
2 379.99
3 379.99
InputCopy OutputCopy
题目信息
题号
186B
时间限制
2 s
内存限制
256 MB
标签
贪心
排序

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。