PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000025. Xóa hết dãy theo điều kiện chia hết (Di-visible Confusion)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Xóa hết dãy theo điều kiện chia hết (Di-visible Confusion)
Di-visible Confusion
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given an integer array, you may delete an element at its current one-based position only when its value is not divisible by . The remaining elements close the gap and indices change. Determine whether the entire array can be deleted.
Input
First line ; second line elements .
Output
Print YES if possible, otherwise NO.
Subtasks
- Subtask 1 (20 points): ;
- Subtask 2 (30 points): ;
- Subtask 3 (50 points): ;
Examples
Input
3
1 2 3
Output
YES
Explanation
Delete the element at index (not divisible by ), then delete at index , and finally the remaining .