A plotter is a vector graphics printing device that connects to a computer to print graphical plots. There are two types of plotters: pen plotters and electrostatic plotters. Pen plotters print by moving a pen across the surface of a piece of paper. They can draw complex line art, including text, but do so very slowly because of the mechanical movement of the pens. In this problem, we are considering this matter of slowness for our special type of pen plotter. A discrete horizontal pen plotter can draw only horizontal line segments whose end points have discrete coordinates (integer x
$(y \leftarrow y+1)$
-->
(y y + 1)
It takes one unit of time to move the pen one unit of length to the left <!-- MATH
$(x \leftarrow x-1)$
-->
(x x - 1)
$(x \leftarrow x+1)$
-->
(x x + 1)
Since it might take a long time for the plotter to draw all the given line segments, we have decided to add a new feature to our plotter: drawing time-limit. By specifying the time-limit, the plotter should draw the maximum number of lines (using the same drawing method given above) that can be drawn within that time-limit. Given the time-limit and line segments, you should find this maximum number.
The input contains multiple test cases. Each test case starts with a line containing two integers n
$(n \le 1000)$
-->
(n<=1000)
$(t \le 10{6})$
-->
(t<=106)
$(0 \le y \le 2000)$
-->
(0<=y<=2000)
$(0 \le x_{s} \le x_{t} \le 10{6})$
-->
(0<=xs<=xt<=106)
Write the result of the i
1 3 0 1 2 3 5 1 1 2 3 1 3 1 3 4 3 6 1 1 2 3 1 3 1 3 4 4 11 1 3 4 1 1 2 2 1 2 2 3 4 0 0
1 1 2 3
Migrated from old NTUJ.
ICPC Tehran, 2008
No. | Testdata Range | Score |
---|