AtCoder Regular Contest 198 (Div. 2)
C
Error Swap
AtCoder
⌀ 1954
原题
← BD →
翻译中…

Problem Statement

翻译中…

You are given two integer sequences of length $N$: $A=(A_1,A_2,\dots,A_N)$ and $B=(B_1,B_2,\dots,B_N)$.

翻译中…

You may perform at most $31000$ operations of the following kind:

翻译中…
  • Choose a pair of integers $(i,j)$ with $1 \le i < j \le N$, then replace $A_i$ with $A_j - 1$ and $A_j$ with $A_i + 1$.
翻译中…

Your goal is to make $A = B$. Determine whether the goal is achievable, and if it is, output one sequence of operations that achieves it.

翻译中…

Constraints

翻译中…
  • $2 \le N \le 100$
  • $1 \le A_i,B_i \le 100$
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N
A_1\ A_2\ \dots\ A_N
B_1\ B_2\ \dots\ B_N

翻译中…

Output

翻译中…

If it is possible to make $A = B$, output Yes; otherwise, output No.

翻译中…

If you output Yes, also output an operation sequence in the following format:

翻译中…

M
i_1\ j_1
i_2\ j_2
\vdots
i_M\ j_M

翻译中…

$M$ is the length of the operation sequence and must satisfy $0 \le M \le 31000$. $i_k, j_k$ are the indices $i, j$ chosen in the $k$-th operation and must satisfy $1 \le i_k < j_k \le N$.

翻译中…

If multiple solutions exist, any of them will be accepted.

翻译中…

样例

Input #1
4
2 2 1 4
3 2 2 2
Output #1
Yes
2
1 4
3 4
The following operations make $A = B$: - Choose $(i,j) = (1,4)$. Then $A = (3,2,1,3)$. - Choose $(i,j) = (3,4)$. Then $A = (3,2,2,2)$. Since minimizing the number of operations is not required, the following output is also accepted:
Input #2
6
5 4 4 3 4 2
5 1 2 3 4 1
Output #2
No
Input #3
7
2 4 2 4 3 2 5
5 4 3 2 5 1 2
Output #3
Yes
18
5 7
1 7
2 4
1 5
1 5
1 4
4 5
4 5
3 4
5 7
1 5
1 7
1 6
6 7
1 7
2 4
2 5
4 5
题目信息
题号
arc198_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。