問題一覧 > 通常問題

No.2074 Product is Square ?

レベル : / AI推定難易度 : 1550 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 104
作問者 : chineristAC / テスター : 👑 AngrySadEight
お気に入りにしたユーザー ProblemId : 8495 / 自分の提出
問題文最終更新日: 2022-09-16 18:47:10
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 360 (順位表) の他の問題:

Problem Statement

Is $\prod_{i=1}^{N} A_i$ a perfect square?

Answer for $T$ test cases.

Input

The input is given in the following format.
$T$
$case_1$
$case_2$
$\vdots$
$case_{T}$
Each test case is given in the following format.
$N$
$A_1$ $A_2$ $\dots$ $A_N$
  • $1 \le T \le 500$
  • $1 \le N \le 1000$
  • The sum of $N$ over all test cases is at most $2000$
  • $1 \le A_i \le 10^{18}$
  • All input values are integers

Output

Print $T$ lines. On the $k$-th line, print Yes if $\prod_{i=1}^{N}A_i$ is a perfect square for the $k$-th test case, and No otherwise.

Sample

Sample 1
Input
3
3
2 3 6
4
1 2 3 4
5
123 342 410 20 57
Output
Yes
No
Yes

For the $1$-st test case, $2 \times 3 \times 6 = 6^2$ is a perfect square.

For the $2$-nd test case, $1 \times 2 \times 3 \times 4 = 24$ is not a perfect square.

For the $3$-rd test case, $123 \times 342 \times 410 \times 20 \times 57 = 140220^2$ is a perfect square.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。