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

建议使用的浏览器:

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

3722:We're Going In

题目描述

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 blockade line is L meters long and there are N Empire's soldiers patrolling along the line.
  • The soldiers move one meter per second.
  • Each soldier's vision covers a range of R meters, both in front of and behind him.
  • When a soldier meets (the soldier meets, not his vision meets) an end of the line, he turns around and continues his patrol.

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__I(x)=\int_{x}^{x+T} f(t)dt \qquad (x \geq 0) 

输入解释

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 ≤ xL) 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

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

源链接: POJ-3722

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

共提交 0

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