

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 点
問題文
正整数の無限列 が以下の条件をともに満たすとき、またそのときに限りそれを 良い と呼びます。
- ある有限の定数 が存在し、すべての について である。
- すべての正整数の組 に対し、 と とは同値である。ここで、 は が を割り切ることを表す。
長さ の整数列 が与えられます。 で始まる良い無限列が存在するか判定してください。
解くべきテストケースは 個あります。
制約
- ひとつの入力の中のテストケースすべてにわたる の総和は 以下である。
- すべての入力値は整数である。
入力
入力は標準入力から以下の形式で与えられる。
各テストケースは以下の形式で与えられる。
出力
各テストケースについて、 で始まる良い無限数列が存在するなら Yes
、そうでないなら No
と出力せよ。
Yes
または No
の出力において、各文字は大文字・小文字のいずれでもよい。
入力例 1Copy
5 5 1 2 3 4 5 5 1 4 9 16 25 5 1 4 6 8 10 5 1 2 4 4 5 5 1 2 3 5 4
出力例 1Copy
Yes Yes Yes No No
番目のテストケースについて、 とでき、これは条件を満たします。
Score : points
Problem Statement
We call an infinite sequence of positive integers good if and only if it satisfies both of the following conditions:
-
There exists a finite constant such that for all ;
-
For all pairs of positive integers , if and only if . Here, means divides .
You are given a positive integer sequence of length . Check if there exists a good infinite sequence starting with .
You have testcases to solve.
Constraints
- The sum of across the test cases in a single input is at most .
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Each test case is given in the following format:
Output
For each test case, if there exists a good infinite sequence starting with , print Yes
, and otherwise print No
.
In printing Yes
or No
, you can output each letter in any case (upper or lower).
Sample Input 1Copy
5 5 1 2 3 4 5 5 1 4 9 16 25 5 1 4 6 8 10 5 1 2 4 4 5 5 1 2 3 5 4
Sample Output 1Copy
Yes Yes Yes No No
For the -st test case, we can let and that satisfies the condition.