#GL0000297. Trò chơi số dư (Remainders Game)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Trò chơi số dư (Remainders Game)
Remainders Game
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Pari secretly chooses a positive integer and reveals a positive integer to Arya. A list of positive integers is also known.
Arya may learn the remainders for any or all indices . Arya wants to determine uniquely the remainder , regardless of the secret value .
Decide whether this is always possible. If two different secrets can yield identical remainders for all but different remainders modulo , the answer is negative.
Input
The first line contains . The second line contains exactly positive integers .
Output
Print Yes if Arya can always determine ; otherwise print No. Capitalization must match exactly.
Subtasks
- Subtask 1 (20 points): ; ; for each .
- Subtask 2 (30 points): ; ; for each .
- Subtask 3 (50 points): ; ; for each .
Examples
Examples 1
Input
4 5
2 3 5 12
Output
Yes
Explanation
Since , Arya can directly request , so the answer is Yes.
Examples 2
Input
2 7
2 3
Output
No
Explanation
The secrets and have identical remainders modulo both and , but their remainders modulo are and , so the answer is No.