

Time Limit: 2 sec / Memory Limit: 256 MB
配点 : 点
問題文
長さ の数列 と が与えられます。 以下の操作を 回以上好きなだけ繰り返して、数列 と を一致させられるか判定してください。
操作: 以上 以下の整数 (一致していてもよい)を選び、次の2つのことを同時に行う。
- に を足す
- に を足す
制約
- ()
- 入力は全て整数
入力
入力は以下の形式で標準入力から与えられる。
出力
操作を 回以上繰り返して数列 と を一致させられるなら Yes
を、 そうでないなら No
を出力せよ。
入力例 1Copy
3 1 2 3 5 2 2
出力例 1Copy
Yes
例えば、次のように 回操作すればよいです。
- 回目: . これによって , となります。
- 回目: . これによって , となります。
- 回目: . これによって , となります。
入力例 2Copy
5 3 1 4 1 5 2 7 1 8 2
出力例 2Copy
No
入力例 3Copy
5 2 7 1 8 2 3 1 4 1 5
出力例 3Copy
No
Score : points
Problem Statement
You are given two integer sequences of length : and . Determine if we can repeat the following operation zero or more times so that the sequences and become equal.
Operation: Choose two integers and (possibly the same) between and (inclusive), then perform the following two actions simultaneously:
- Add to .
- Add to .
Constraints
- ()
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Output
If we can repeat the operation zero or more times so that the sequences and become equal, print Yes
; otherwise, print No
.
Sample Input 1Copy
3 1 2 3 5 2 2
Sample Output 1Copy
Yes
For example, we can perform three operations as follows to do our job:
- First operation: and . Now we have , .
- Second operation: and . Now we have , .
- Third operation: and . Now we have , .
Sample Input 2Copy
5 3 1 4 1 5 2 7 1 8 2
Sample Output 2Copy
No
Sample Input 3Copy
5 2 7 1 8 2 3 1 4 1 5
Sample Output 3Copy
No