TopCoder

niter
Random is magic.

User's AC Ratio

88.0% (22/25)

Submission's AC Ratio

27.7% (39/141)

Tags

Description

給你 n 個整數 a1...anm 個整數 b1...bm,令 A=a1! × ... ×an! , B=b1! × ... ×bm!,若 B|A 輸出 "Yes",否則輸出 "No"。

Input Format

第一行有兩個整數n,m
第二行有n個整數a1...an
第三行有m個整數b1...bm
n,m106, ai,bi107

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,ai,bi1000 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