A8436 | Smart Cheater
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
I guess there's not much point in reminding you that Nvodsk winters aren't exactly hot. That increased the popularity of the public transport dramatically. The route of bus $62$ has exactly $n$ stops (stop $1$ goes first on its way and stop $n$ goes last). The stops are positioned on a straight line and their coordinates are $0=x_{1}<x_{2}<...<x_{n}$ .
Each day exactly $m$ people use bus $62$ . For each person we know the number of the stop where he gets on the bus and the number of the stop where he gets off the bus. A ticket from stop $a$ to stop $b$ ( $a<b$ ) costs $x_{b}-x_{a}$ rubles. However, the conductor can choose no more than one segment NOT TO SELL a ticket for. We mean that conductor should choose C and D (С <= D) and sell a ticket for the segments \[ $A$ , $C$ \] and \[ $D$ , $B$ \], or not sell the ticket at all. The conductor and the passenger divide the saved money between themselves equally. The conductor's "untaxed income" is sometimes interrupted by inspections that take place as the bus drives on some segment of the route located between two consecutive stops. The inspector fines the conductor by $c$ rubles for each passenger who doesn't have the ticket for this route's segment.
You know the coordinated of all stops $x_{i}$ ; the numbers of stops where the $i$ -th passenger gets on and off, $a_{i}$ and $b_{i}$ ( $a_{i}<b_{i}$ ); the fine $c$ ; and also $p_{i}$ — the probability of inspection on segment between the $i$ -th and the $i+1$ -th stop. The conductor asked you to help him make a plan of selling tickets that maximizes the mathematical expectation of his profit.
Each day exactly $m$ people use bus $62$ . For each person we know the number of the stop where he gets on the bus and the number of the stop where he gets off the bus. A ticket from stop $a$ to stop $b$ ( $a<b$ ) costs $x_{b}-x_{a}$ rubles. However, the conductor can choose no more than one segment NOT TO SELL a ticket for. We mean that conductor should choose C and D (С <= D) and sell a ticket for the segments \[ $A$ , $C$ \] and \[ $D$ , $B$ \], or not sell the ticket at all. The conductor and the passenger divide the saved money between themselves equally. The conductor's "untaxed income" is sometimes interrupted by inspections that take place as the bus drives on some segment of the route located between two consecutive stops. The inspector fines the conductor by $c$ rubles for each passenger who doesn't have the ticket for this route's segment.
You know the coordinated of all stops $x_{i}$ ; the numbers of stops where the $i$ -th passenger gets on and off, $a_{i}$ and $b_{i}$ ( $a_{i}<b_{i}$ ); the fine $c$ ; and also $p_{i}$ — the probability of inspection on segment between the $i$ -th and the $i+1$ -th stop. The conductor asked you to help him make a plan of selling tickets that maximizes the mathematical expectation of his profit.
输入格式
The first line contains three integers $n$ , $m$ and $c$ ( $2<=n<=150000$ , $1<=m<=300000$ , $1<=c<=10000$ ).
The next line contains $n$ integers $x_{i}$ ( $0<=x_{i}<=10^{9}$ , $x_{1}=0$ , $x_{i}<x_{i+1}$ ) — the coordinates of the stops on the bus's route.
The third line contains $n-1$ integer $p_{i}$ ( $0<=p_{i}<=100$ ) — the probability of inspection in percents on the segment between stop $i$ and stop $i+1$ .
Then follow $m$ lines that describe the bus's passengers. Each line contains exactly two integers $a_{i}$ and $b_{i}$ ( $1<=a_{i}<b_{i}<=n$ ) — the numbers of stops where the $i$ -th passenger gets on and off.
The next line contains $n$ integers $x_{i}$ ( $0<=x_{i}<=10^{9}$ , $x_{1}=0$ , $x_{i}<x_{i+1}$ ) — the coordinates of the stops on the bus's route.
The third line contains $n-1$ integer $p_{i}$ ( $0<=p_{i}<=100$ ) — the probability of inspection in percents on the segment between stop $i$ and stop $i+1$ .
Then follow $m$ lines that describe the bus's passengers. Each line contains exactly two integers $a_{i}$ and $b_{i}$ ( $1<=a_{i}<b_{i}<=n$ ) — the numbers of stops where the $i$ -th passenger gets on and off.
输出格式
Print the single real number — the maximum expectation of the conductor's profit. Your answer will be considered correct if its absolute or relative error does not exceed $10^{-6}$ .
Namely: let's assume that your answer is $a$ , and the answer of the jury is $b$ . The checker program will consider your answer correct, if .
Namely: let's assume that your answer is $a$ , and the answer of the jury is $b$ . The checker program will consider your answer correct, if .
输入输出样例
输入 #1
3 3 10 0 10 100 100 0 1 2 2 3 1 3
输出 #1
90.000000000
输入 #2
10 8 187 0 10 30 70 150 310 630 1270 2550 51100 13 87 65 0 100 44 67 3 4 1 10 2 9 3 8 1 5 6 10 2 7 4 10 4 5
输出 #2
76859.990000000
A comment to the first sample:
The first and third passengers get tickets from stop $1$ to stop $2$ . The second passenger doesn't get a ticket. There always is inspection on the segment $1$ - $2$ but both passengers have the ticket for it. There never is an inspection on the segment $2$ - $3$ , that's why the second passenger gets away with the cheating. Our total profit is $(0+90/2+90/2)=90$ .
The first and third passengers get tickets from stop $1$ to stop $2$ . The second passenger doesn't get a ticket. There always is inspection on the segment $1$ - $2$ but both passengers have the ticket for it. There never is an inspection on the segment $2$ - $3$ , that's why the second passenger gets away with the cheating. Our total profit is $(0+90/2+90/2)=90$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted