Destroy ba<x>se
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
Problem Description
A base is developing chemicals
of mass destruction. In order to prevent attack, there are several invisible
protective panels above the base.
Now a army code TT01 receive a mission to destroy the
base as soon as possible. At present, TT-1 is the most powerful weapon in the army. However, after many attacks, a
difficult problem was found when TT-1 fires vertically at the base from above, it does not penetrate layers of
protective panels, but slides down panels to the end point. If the end point is within the range of the
base, it can be destroyed, otherwise the base cannot be destroyed.
Good news, enhanced
version of weapon TT-2 has been
developed. It is based on TT-1 plus
materials that can penetrate protective panels. Through the activation
mechanism, TT-2 can choose to penetrate
one layer, go on slide down panel, TT-2 can still choose to penetrate one layer...... It is a pity that every time TT2 breaks
through a protective shield, the energy decreases. the energy decay formula is y=e-ax
For
convenience, we transform this problem into two-dimensional space. The base is
an interval [l, r] on the x-axis, invisible protective panels are modeled as line segments(x1,y1, x2,y2) above the x-axis. The panels
are slanted, that is, not parallel to the x- or y-axes. TT-2 fires
vertically from
above. When any TT-2 fires on a panel, it can flows toward the panel’s lower end and falls off from
there. But the penetration mechanism is activated, it can also penetrate one
layer instead. After TT-2 falls off a pannel, it continues to fall vertically. This repeats until TT-2 hits the base. Finally, maximum destructive power
of TT2 to the base as follows:
Z=t/w*e-ax
t is the initial energy of
TT2, w is base length , x is number of TT2 penetrate the panels, a is
given parameter.
due to the rarity of penetrating materials, we need to know how many
penetration mechanisms can be activated at least to hit the base point , how much damage can be achieved.
Input Format
The
first line of input contains five integers t, a, l, r and n, where [l, r] is the Left and right boundary of
the base and n is the number of panels.
Each of the following n lines
describes a panel and contains four integers x1, y1, x2, y2.
Where t is a integer , a is a real number , l, r, x, y are integers. and x1 and x2 for all panels are all distinct. The pannels described in the
input will not intersect, and no endpoint of a panel will lie on another panel.
( 102 ≤ t ≤ 109 , 0.00<a<1 , 0 ≤ l< r ≤ 109 ,
0
≤ n ≤ 5 · 105 , 0 ≤ x1, x2 , y1
, y2≤ 109 x1 ≠x2, y1 ≠y2, ).
Output Format
The
maximum destructive power of TT2 to the
base, accurate to 3 decimal places
800 0.192540 10 20 2
5 2 15 15
2 80 25 7082.592