当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3413:RPG

Special Judge 特殊评判
题目描述

To complete a role-playing game (RPG), you must send your character through N quests. The quests may be passed in any order, but after starting a quest you can’t drop it and switch to another. If your character fails even one quest you fail the whole game. The probability of succeeding in a quest depends on the experience points (XP) of your character at the beginning of the quest, and is determined by the formula
where ai and bi are parameters of the i-th quest.
After successful completion of the i-th quest, your character obtains Si experience points. Initially, it/he/she has D points.

Write a program to determine such an order of the quests that the probability of completing the whole game successfully is the highest possible.

输入解释

The first line of the input contains the values N (1≤N≤10) and D. Each of the following N lines describes one quest, containing the values ai, bi, Si. The values D, ai, bi, Si (1≤iN) are all integers in the range from 0 to 1000 and ai<bi (1≤iN). Adjacent values on the same line are separated by one or more spaces.

输出解释

The first line of the output must contain the highest possible probability with the precision of 0.001. The second line must contain the order of quests that ensures this probability. If there are several orders with the same probability, output any one of them.

输入样例
3 300
350 380 100
100 200 100
440 450 100
输出样例
1.000
2 1 3

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3413

最后修改于 2020-10-29T07:00:59+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536