当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。
As the standoff with Empire's Army continues, the Commander of Union, Yang, finally loses his patience. He intends to send a troop going through the long straight blockade line secretly and spying into enemy's activities.
After several days' observation, the Commander finds the following facts:
The whole break-through will last T seconds. To make sure the action successes, Yang wants to maximize the average uncovered length during the T seconds. In another word, assuming the function f(t) indicating the uncovered length of the blockade line at time t. Yang wants to maximize the definite integral:
__poj_jax_start__I(x)=\int_{x}^{x+T} f(t)dt \qquad (x \geq 0) __poj_jax_end__
The first line of input contains four integers, L, R, N, T (0 ≤ L, R, T ≤ 1000000), (0 ≤ N ≤ 100).
The following N lines describe the soldiers. Each line consists of two integers, x (0 ≤ x ≤ L) and d. x indicates the initial position of the soldier and d indicates the direction of soldier's movement. The soldier moves to the end with x = L when d = 1 and to the end with x = 0 when d = -1.
Output the maximum I(x) with three digits after the decimal point.
10 1 1 3 1 1
25.000
时间上限 | 内存上限 |
4000 | 65536 |