시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 1024 MB43201743.590%

문제

You are designing a controller for an interesting aircraft called the Single Copter. It only has one propeller, but the outgoing air flow is further shaped by four flaps that control three Euler angles (pitch, roll and yaw) that help maintain the requested orientation of the craft. Each of these flaps can assume any angle requested by the flight controller, and the effects of the flaps being at certain angles should translate to exerting the requested forces on pitch, roll and yaw.

Pitch Roll Yaw

Figure D.1: Pitch, roll and yaw on a Single Copter

Define the angles of the flaps to be $n$, $e$, $s$, and $w$ (for "north", "east", "south" and "west" respectively). The forces in the directions of pitch, roll and yaw are defined by the following equations:

\begin{align*} p &= e - w \\ r &= n - s \\ y &= n + e + s + w \end{align*}

As there are four variables and three constraints, you decided that, from the perspective of aerodynamics, it makes sense to make the maximum of the flap angles as small as possible, that is, you additionally want to minimise $\max\{ |n|, |e|, |s|, |w| \}$.

Find the best parameters to send to the Single Copter to achieve the desired pitch, yaw, and roll.

입력

  • One line containing the number $q$, $1 \le q \le 10^4$, the number of requests to follow.
  • $i$ further lines, each containing three real numbers $p_i$, $r_i$, $y_i$ ($-1 \le p_i, r_i, y_i \le +1$).

출력

Output $q$ lines. In the $i$-th line, output the solution for the $i$-th request, four numbers $n_i$, $e_i$, $s_i$, $w_i$, separated by whitespace.

Your answer will be considered correct if the resulting pitch, roll and yaw differ by at most $10^{-6}$ from the requested ones, and the maximum of the absolute values of flap outputs does not exceed the true value by more than $10^{-6}$.

예제 입력 1

8
0 0 0
1 0 0
0 1 0
0 0 1
1 1 0
1 0 1
0 1 1
1 1 1

예제 출력 1

0.0 0.0 0.0 0.0
0.0 0.5 0.0 -0.5
0.5 0.0 -0.5 0.0
0.25 0.25 0.25 0.25
0.5 0.5 -0.5 -0.5
0.5 0.5 0.5 -0.5
0.5 0.5 -0.5 0.5
0.75 0.75 -0.25 -0.25

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2024 D번

  • 문제를 만든 사람: Maxim Buzdalov