#ABC479G. 调参 / Tuning
调参 / Tuning
Problem Statement
You are given length- integer sequences and . Consider length- sequences of rational numbers and that satisfy the following condition.
- for all .
Find the minimum possible value of $\displaystyle \sum_{i=1}^{N} \left ( |c_i|+|d_i| \right )$.
It can be proved that the answer to this problem can be uniquely represented as an irreducible fraction with a positive denominator and a non-negative numerator. Output these and .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
When the answer to this problem is represented as an irreducible fraction with a positive denominator and a non-negative numerator, output it in the following format:
3
4 1 -8
3 1 -6
1 4
For example, you can set , which achieves $\sum_{i=1}^{N} \left ( |c_i|+|d_i| \right ) = \frac{1}{4}$. Also, cannot be made smaller than this.
2
2 2
3 3
0 1
If the answer is , it is represented as , so output 0 1.
10
855263 -919070 120736 -779959 -789624 789495 -541451 139160 -406547 32421
-612084 -707431 843213 834659 -424146 549941 -799392 -553082 732456 357127
635454493436 120459
- Source: AtCoder ABC 479 G
相关
在下列比赛中: