PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000127. Hossam và các học viên (Hossam and Trainees)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Hossam và các học viên (Hossam and Trainees)
Hossam and Trainees
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
There are trainees with positive integer labels . A pair of trainees at distinct indices is successful if some integer divides both labels. Determine whether at least one successful pair exists.
Input
The first line contains ; the next contains integers .
Output
Print YES if a successful pair exists; otherwise print NO.
Subtasks
- Subtask 1 (20 points): ; .
- Subtask 2 (30 points): ; .
- Subtask 3 (50 points): ; .
Examples
Input
3
32 48 7
Output
YES
Explanation
Both 32 and 48 are divisible by 2 (also by 16), so a successful pair exists, regardless of 7.