调谐AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)You are given length-$N$ integer sequences $A=(A_1,A_2,\dots,A_N)$ and $B=(B_1,B_2,\dots,B_N)$.
Consider length-$N$ sequences of rational numbers $c=(c_1,c_2,\dots,c_N)$ and $d=(d_1,d_2,\dots,d_N)$ that satisfy the following condition.
给定长度为 $N$ 的整数序列 $A=(A_1,A_2,\dots,A_N)$ 和 $B=(B_1,B_2,\dots,B_N)$。
考虑满足以下条件的长度为 $N$ 的有理数序列 $c=(c_1,c_2,\dots,c_N)$ 和 $d=(d_1,d_2,\dots,d_N)$。AI (CI翻译)
$(A_i+c_i)(B_j+d_j)=(A_j+c_j)(B_i+d_i)$for all$1 \le i,j \le N$.
- 对于所有
$1 \le i,j \le N$,都有$(A_i+c_i)(B_j+d_j)=(A_j+c_j)(B_i+d_i)$。
Find the minimum possible value of $\displaystyle \sum_{i=1}^{N} \left ( |c_i|+|d_i| \right )$.
求 $\displaystyle \sum_{i=1}^{N} \left ( |c_i|+|d_i| \right )$ 的最小可能值。AI (CI翻译)
It can be proved that the answer to this problem can be uniquely represented as an irreducible fraction $p/q$ with a positive denominator and a non-negative numerator.
Output these $p$ and $q$.
可以证明,本题的答案可以唯一表示为分母为正、分子非负的最简分数 $p/q$。
输出这两个整数 $p$ 和 $q$。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)- All input values are integers.
$2 \le N \le 2 \times 10^5$$|A_i|, |B_i| \le 10^6$
- 所有输入值均为整数。
$2 \le N \le 2 \times 10^5$$|A_i|, |B_i| \le 10^6$
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入通过标准输入以如下格式给出:AI (CI翻译)
N
A_1 A_2 \dots A_N
B_1 B_2 \dots B_N
N
A_1 A_2 \dots A_N
B_1 B_2 \dots B_NAI (CI翻译)
Output
输出格式
AI (CI翻译)When the answer to this problem is represented as an irreducible fraction $p/q$ with a positive denominator and a non-negative numerator, output it in the following format:
将本题的答案表示为分母为正、分子非负的最简分数 $p/q$,按如下格式输出:AI (CI翻译)
p q
p qAI (CI翻译)
样例
3
4 1 -8
3 1 -6
1 4
2
2 2
3 3
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
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。