政务桌面应用系统开发提升政府服务效率的关键所在
822
2022-11-09
hdu5988 Coding Contest
Coding Contest
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 4164 Accepted Submission(s): 974 Problem Description A coding contest will be held in this university, in a huge playground. The whole playground would be divided into N blocks, and there would be M directed paths linking these blocks. The i-th path goes from the ui-th block to the vi-th block. Your task is to solve the lunch issue. According to the arrangement, there are si competitors in the i-th block. Limited to the size of table, bi bags of lunch including breads, sausages and milk would be put in the i-th block. As a result, some competitors need to move to another block to access lunch. However, the playground is temporary, as a result there would be so many wires on the path. For the i-th path, the wires have been stabilized at first and the first competitor who walker through it would not break the wires. Since then, however, when a person go through the i - th path, there is a chance of pi to touch the wires and affect the whole networks. Moreover, to protect these wires, no more than ci competitors are allowed to walk through the i-th path. Now you need to find a way for all competitors to get their lunch, and minimize the possibility of network crashing.
Input The first line of input contains an integer t which is the number of test cases. Then t test cases follow. For each test case, the first line consists of two integers N (N ≤ 100) and M (M ≤ 5000). Each of the next N lines contains two integers si and bi (si , bi ≤ 200). Each of the next M lines contains three integers ui , vi and ci(ci ≤ 100) and a float-point number pi(0 < pi < 1). It is guaranteed that there is at least one way to let every competitor has lunch.
Output For each turn of each case, output the minimum possibility that the networks would break down. Round it to 2 digits.
Sample Input 1 4 4 2 0 0 3 3 0 0 3 1 2 5 0.5 3 2 5 0.5 1 4 5 0.5 3 4 5 0.5
Sample Output 0.50
Source 2016ACM/ICPC亚洲区青岛站-重现赛(感谢中国石油大学)
这题非常的强orz 如何把乘法运算变成加法然后跑费用流 没错针对这个分数取一下log即可 但是问题在于这都是负数啊 我跑费用流 汇出现负权圈会有问题 那怎么办 我要求碰电线的概率最小是不是就是不碰电线的概率最大 所以我可以改为求-log(1-p)取一下对数 跑最小费用最大流即可 最后计算答案的时候由于都是对数 我要求的是总的概率最小 所以我直接把这些数加起来得到这个费用 然后再exp 求得e^x=ans 得到x 最后我的答案因为我预处理的时候是1-p所以 我需要输出1-x 这题可能我太菜了 竟然要卡常 spfa需要写slf优化 这个eps是看网上的人都这么写的 不知道如何计算这个eps gg
#include
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~