#P6299. 差别
差别
Description
Define the difference measure between integers and the given integers as
$$M=\Big|\left(a^2+b^2\right)\left(p^2+q^2\right)+\left(c^2+d^2\right)\left(r^2+s^2\right)+2\big(ac+bd\big)\big(pr-qs\big)+2\big(bc-ad\big)\big(ps+qr\big)\Big|$$Your task is to find the smallest non-zero value of the difference measure , and one set of that achieves this smallest non-zero value. It is guaranteed that the smallest non-zero value of exists and is less than . It is also guaranteed that there exists a set of with all absolute values less than such that attains the smallest non-zero value.
Input Format
Input one line with four integers , as described above.
Output Format
Output one line with five integers , representing a set of that makes the difference measure reach its smallest non-zero value, and the value of at that time.
1 9 2 6
2 1 -3 1 2
19674937 18722417 163948077 124500851
146134 -61558 -18260 -10209 221162
Hint
Sample Explanation #1
Obviously, when , the difference measure must be even, so cannot take any non-zero value smaller than .
Constraints
| Test Point ID | Special Property |
|---|---|
| $\vert a\vert,\vert b\vert,\vert c\vert,\vert d\vert\le10$ | |
| None |
For of the testdata, $\vert a\vert,\vert b\vert,\vert c\vert,\vert d\vert\le10^9$.
Scoring Method
You must ensure that the number of values you output for each test point is and that $\vert p\vert,\vert q\vert,\vert r\vert,\vert s\vert,\vert M\vert<2^{63}$, to avoid unexpected errors.
For each test point, if your is the same as the standard output, you will get points. If the you output can make the computed result equal to , you will get another points.
Translated by ChatGPT 5
京公网安备 11011102002149号