結果
| 問題 | No.2074 Product is Square ? | 
| コンテスト | |
| ユーザー |  titia | 
| 提出日時 | 2022-09-20 03:29:17 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 424 ms / 2,000 ms | 
| コード長 | 489 bytes | 
| コンパイル時間 | 184 ms | 
| コンパイル使用メモリ | 82,048 KB | 
| 実行使用メモリ | 68,352 KB | 
| 最終ジャッジ日時 | 2024-12-22 03:03:46 | 
| 合計ジャッジ時間 | 8,154 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 33 | 
ソースコード
import sys
input = sys.stdin.readline
from math import gcd
T=int(input())
for tests in range(T):
    N=int(input())
    A=list(map(int,input().split()))
    for i in range(N):
        for j in range(i+1,N):
            x=gcd(A[i],A[j])
            if x!=1:
                A[i]//=x
                A[j]//=x
                
    for a in A:
        x=round(a**(1/2))
        if x*x==a:
            pass
        else:
            print("No")
            break
    else:
        print("Yes")
            
            
            
        