luogu#P4894. GodFly 求解法向量

GodFly 求解法向量

Background

“Differentiate blindly when you see a function, and set up a coordinate system blindly when you see geometry.” This is a common trait of stubborn learners.

As a stubborn learner who likes setting up coordinate systems, GodFly often needs to compute normal vectors.

Problem Description

On plane α\alpha, there are two intersecting vectors a=(x1,y1,z1)\vec{a}=(x_1,y_1,z_1) and b=(x2,y2,z2)\vec{b}=(x_2,y_2,z_2). If z=(x,y,z)\vec{z}=(x,y,z) is a normal vector of plane α\alpha, then:

$$\begin{cases} x \times x _ 1 + y \times y _ 1 + z \times z _ 1 = 0 \\ x \times x _ 2 + y \times y _ 2 + z \times z _ 2 = 0 \end{cases}$$

You are now given the coordinates of a\vec{a} and b\vec{b}. Find one normal vector z\vec{z} and output its coordinates.

Input Format

This problem contains multiple test cases. For each test case, one line contains six numbers: x1,y1,z1,x2,y2,z2x_1,y_1,z_1,x_2,y_2,z_2.

Output Format

For each test case, output three numbers x,y,zx,y,z, separated by spaces.

Separate outputs of different test cases with a blank line. The coordinates of the normal vector cannot all be 00.

1 2 3 3 2 1
1 -2 1

Hint

Constraints

All coordinates (including the answer) are within the 3232-bit integer range.

  • For 30%30\% of the testdata, there is only one test case.
  • For 100%100\% of the testdata, the number of test cases 5×104\le 5\times 10^4, and all input coordinates are positive integers with absolute values not exceeding 5×1045 \times 10^4.

Hint

This problem uses Special Judge. You may output any valid solution.

Translated by ChatGPT 5