LaTeX挂了
查看原帖
LaTeX挂了
531709
LittleAcbg楼主2023/11/25 19:40

RT,如下。

Kirill has two integer arrays a1,a2,…,ana_1,a_2,…,a_n and b1,b2,…,bnb_1,b_2,…,b_n of length nn. He defines the absolute beauty of the array bb as

∑i=1n∣ai−bi∣\sum_{i=1}^n|a_i-b_i|

Here, ∣x∣|x| denotes the absolute value of xx.

Kirill can perform the following operation at most once:

  • select two indices ii and jj (1≤i<j≤n1≤i<j≤n) and swap the values of bib_i and bjb_j.

Help him find the maximum possible absolute beauty of the array bb after performing at most one swap.

Kirill has two integer arrays $a_1,a_2,…,a_n$ and $b_1,b_2,…,b_n$ of length $n$. He defines the _absolute beauty_ of the array $b$ as
$$
\sum_{i=1}^n|a_i-b_i|
$$
Here, $|x|$ denotes the absolute value of $x$.

Kirill can perform the following operation **at most once**:

- select two indices $i$ and $j$ ($1≤i<j≤n$) and swap the values of $b_i$ and $b_j$.

Help him find the maximum possible absolute beauty of the array $b$ after performing **at most one** swap.
2023/11/25 19:40
加载中...