#P2698. [USACO12MAR] Flowerpot S

    ID: 3510 远端评测题 1000ms 125MiB 尝试: 1 已通过: 1 显示难度普及+/提高− 上传者: 标签>2012二分USACO单调队列

[USACO12MAR] Flowerpot S

Problem Description

Farmer John has been having trouble making his plants grow, and needs your help to water them properly. You are given the locations of NN raindrops (1≤N≤100,000)(1 \leq N \leq 100,000) in the 2D plane, where yy represents vertical height of the drop, and xx represents its location over a 1D number line:

Each drop falls downward (towards the xx axis) at a rate of 11 unit per second. You would like to place Farmer John's flowerpot of width WW somewhere along the xx axis so that the difference in time between the first raindrop to hit the flowerpot and the last raindrop to hit the flowerpot is at least some amount DD (so that the flowers in the pot receive plenty of water). A drop of water that lands just on the edge of the flowerpot counts as hitting the flowerpot.

Given the value of DD and the locations of the NN raindrops, please compute the minimum possible value of WW.

4 5
6 3
2 4
4 10
12 15
2