結果

問題 No.2074 Product is Square ?
ユーザー flygonflygon
提出日時 2022-09-16 23:13:00
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 361 bytes
コンパイル時間 188 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 141,312 KB
最終ジャッジ日時 2024-12-21 22:47:02
合計ジャッジ時間 97,643 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 TLE * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd


t = int(input())
for i in range(t):
  n = int(input())
  a = list(map(int,input().split()))
  now = 1
  for i in range(n):
    g = gcd(now, a[i])
    now = (now//g)*(a[i]//g)
    sq = int(pow(now,0.5))
    for i in range(min(0, sq-5), sq+5):
      if sq ** 2 == now:
        now = 1
  if now == 1:
    print('Yes')
  else:
    print('No')
0