#P8282. 「MCOI-08 / AC6-M12」Weapons of Mass Destruction

    ID: 9343 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 9 上传者: 标签>洛谷原创Special JudgeO2优化凸包洛谷月赛

「MCOI-08 / AC6-M12」Weapons of Mass Destruction

Background

Garuda Team, I've got some good news.

The chemical agent used as a catalyst for their WMD is being transported to our shores from the Estovakian mainland.

This catalyst has already been carried into the outskirts of Gracemeria.

As a measure of caution against any attempts to destroy it, it has been concealed at Fort Norton in Gracemeria's north.

If we start advancing again, the enemy will most likely bring the catalyst into Gracemeria at a faster pace.

If in fact weapons of mass destruction are used on the population of Gracemeria, the resulting devastation can't be expressed in enough words.

It will lead to unspeakable tragedies.

We've used this intelligence to come up with a solid proposal on how to prevent this scorched earth policy from being executed in our capital.

Just a minute ago, we received a letter of approval for our prevention plan from the Joint Chiefs of Staff.

The proposal we put on the table for our scorched earth prevention policy is really quite simple.

While the enemy transport unit is stationed at Fort Norton, we'll ambush them.

We like to call it our tactic for pre-emptive victory.

The enemy has loaded this catalyst into their transport vehicles and is able to send them into Gracemeria at any time.

This plan will be carried out by a handful of our top pilots under absolute secrecy.

Fly through Fort Norton's canyon at an extremely low altitude to avoid radar detection, and take out those transport vehicles.

We've determined that a high-risk mission of this magnitude could not be executed by anyone other than Garuda Team.

We're counting on a flawless execution here.

$$_{{\frac{\large\text{ACE COMBAT }\Large6}{\tiny{\text{F i r e s\quad O f\quad L i b e r a t i o n}}}}}\\ \text{Mission 12} \\\Large\text{Weapons of Mass Destruction}\\\tiny -\textit{ Boiling Point }-$$

Problem Description

To destroy the enemy convoy carrying the WMD catalyst, you need to pass through Fort Norton's canyon at extremely low altitude to approach them.

Fort Norton is abstracted as two piecewise linear functions on the plane with respect to yy (y[0,107]y\in[0,10^7]), A(y):yxA(y):y\mapsto x and B(y):yxB(y):y\mapsto x. For any real number y[0,107]y\in[0,10^7], it is guaranteed that A(y)B(y)A(y)\le B(y).

You and your F-15E are abstracted as a particle. The initial position is (X1,0)(X_1,0), and it is guaranteed that A(0)X1B(0)A(0)\le X_1\le B(0). At the same time, you have an initial velocity (v0,θ0)(v_0,\theta_0), representing the speed magnitude and direction.

To avoid being detected by the enemy, you cannot run the engine at high power. Your thrust is just enough to keep a constant speed while flying level.

Of course, you can turn. Since you are the protagonist of Ace Combat, all your turns are done using PSM. Specifically, your flight path should be a polyline consisting of several line segments. However, you will suffer drag during turns. If the absolute difference between the direction angle after the change and before the change is α\alpha, then the speed magnitude decreases by α\alpha. If you do not change direction, then you will keep moving in a uniform straight line.

Since Ghost Eye is in a hurry to finish the mission, your yy coordinate must increase over time.

Also, you must ensure that at any time, your position (x,y)(x,y) satisfies A(y)xB(y)A(y)\le x\le B(y).

The overload of PSM turns is huge, so you must ensure that the number of turns does not exceed 3×106\bf 3\times 10^6. Otherwise you will g-LOC like Prez and smash your head into the dashboard.

Find any turning plan such that you move to (X2,107)(X_2,10^7) (that is, the speed must not become 0\bf 0 or negative during the motion), and the number of turns does not exceed 3×1063\times 10^6. Similarly, it is guaranteed that A(107)X2B(107)A(10^7)\le X_2\le B(10^7).

Input Format

The first line contains four integers n,m,X1,X2n,m,X_1,X_2 and two real numbers v0,θ0v_0,\theta_0.

It is guaranteed that the existence of a solution is unchanged within the range v0±106v_0\pm 10^{-6}.

The next nn lines each contain two integers x,yx,y. It is guaranteed that yy is increasing, the first yy is 00, and the last yy is 10710^7. Connecting these points in order with line segments gives the function AA.

The next mm lines each contain two integers p,qp,q, describing the function BB in the same way as AA.

Output Format

First output a line containing 1.

Then, since the particle's trajectory must be a polyline, you need to output the number of vertices KK on the next line, and then output KK lines, each containing two real numbers representing the coordinates of a vertex. Suppose the sequence of points you output is C:{(s1,t1),(s2,t2),,(sK,tK)}C:\{(s_1,t_1),(s_2,t_2),\cdots,(s_K,t_K)\}. Then for all i[1,K)i\in[1,K), connect CiC_i and Ci+1C_{i+1} with a line segment; the resulting polyline is the trajectory you provide.

You must ensure:

  • C1C_1 coincides with X1X_1, and CKC_K coincides with X2X_2.
  • The yy coordinates in CC are monotone.
  • For any 1i<K1\le i<K, ti<ti+1t_i<t_{i+1}.
  • For any point (x,y)(x,y) on the polyline, A(y)106xB(y)+106A(y)-10^{-6}\le x\le B(y)+10^{-6}.
  • The speed is greater than 00 throughout the motion.
  • K3×106K\le 3\times 10^6.

If you correctly output a plan that satisfies all the requirements above, you will be judged as Accepted; otherwise, Wrong Answer. If there are multiple valid plans, you may output any one of them.

This problem uses a Special Judge.

5 4 4000000 9000000 13 0
3000000 0
1000000 1000000
2000000 4000000
6000000 8000000
7000000 10000000
5000000 0
4000000 2000000
6000000 6000000
10000000 10000000
1
4
4000000.0000000000 0.0000000000
3000000.0000000000 2000000.0000000000
4000000.0000000000 6000000.0000000000
9000000.0000000000 10000000.0000000000

Hint

Sample explanation (scaled down by 10610^6):

Note that the particle may touch the boundary during the motion, and it may also move along the boundary for a while.


Constraints:

For 100%100\% of the testdata, it is guaranteed that 2n,m1062\le n,m\le 10^6, 0x,y,p,q1070\le x,y,p,q\le 10^7, x1X1p1x_1\le X_1\le p_1, xnX2pmx_n\le X_2\le p_m, 0θ0<π0\le \theta_0<\pi, and 0v01090\le v_0\le 10^9.

For 100%100\% of the testdata, the real-number precision does not exceed 1212 digits.

For 100%100\% of the testdata, a solution is guaranteed to exist.

  • Subtask 1 (3 pts): n,m6n,m\le 6; v050v_0\ge 50.
  • Subtask 2 (8 pts): n,m6n,m\le 6.
  • Subtask 3 (17 pts): n,m200n,m\le 200.
  • Subtask 4 (13 pts): n,m1500n,m\le 1500.
  • Subtask 5 (17 pts): n,m5000n,m\le 5000.
  • Subtask 6 (19 pts): n,m105n,m\le 10^5.
  • Subtask 7 (23 pts): no additional constraints.

Please pay attention to floating-point output efficiency.


idea: Sol1, solution: Sol1 & w33z8kqrqk8zzzx33, code: Sol1, data: w33z8kqrqk8zzzx33

Translated by ChatGPT 5