TopCoder

niter
$\mathbf{Random~is~magic.}$

User's AC Ratio

88.9% (16/18)

Submission's AC Ratio

26.3% (31/118)

Tags

Description

給你 $n$ 個整數 $a_1...a_n$ 跟 $m$ 個整數 $b_1...b_m$,令 $A=a_ 1! \ \times \ ... \ \times a_ n !$ , $B=b_ 1! \ \times \ ... \ \times b_ m!$,若 $B|A$ 輸出 "Yes",否則輸出 "No"。

Input Format

第一行有兩個整數$n$,$m$。
第二行有$n$個整數$a_ 1 ... a_n$。
第三行有$m$個整數$b_1 ... b_m$。
$n,m \leq 10^ 6$, $a_i,b_i \leq 10^ 7$

Output Format

輸出一行"Yes"或"No"。

Sample Input 1

Sample Input 1:
2 1
5 5
6

Sample Input 2:
1 2
3
2 2

Sample Output 1

Sample Output 1:
Yes

Sample Output 2:
No

Hints

Problem Source

Subtasks

No. Testdata Range Constraints Score
1 0~1 範測 0
2 0~12 $n,m,a_i,b_i \leq 1000$ 29
3 0~23 無其他限制 71

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 3000 524288 65536 1 2 3
1 3000 524288 65536 1 2 3
2 3000 524288 65536 2 3
3 3000 524288 65536 2 3
4 3000 524288 65536 2 3
5 3000 524288 65536 2 3
6 3000 524288 65536 2 3
7 3000 524288 65536 2 3
8 3000 524288 65536 2 3
9 3000 524288 65536 2 3
10 3000 524288 65536 2 3
11 3000 524288 65536 2 3
12 3000 524288 65536 2 3
13 3000 524288 65536 3
14 3000 524288 65536 3
15 3000 524288 65536 3
16 3000 524288 65536 3
17 3000 524288 65536 3
18 3000 524288 65536 3
19 3000 524288 65536 3
20 3000 524288 65536 3
21 3000 524288 65536 3
22 3000 524288 65536 3
23 3000 524288 65536 3