結果

問題 No.2074 Product is Square ?
ユーザー とりゐ
提出日時 2022-09-17 01:51:30
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 376 bytes
コンパイル時間 163 ms
コンパイル使用メモリ 82,788 KB
実行使用メモリ 157,792 KB
最終ジャッジ日時 2024-12-22 00:04:39
合計ジャッジ時間 62,517 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 13 TLE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

def floor_sqrt(n):
  if n<0:
    return -1
  ng,ok=n+1,-1
  while ng-ok>1:
    mid=(ok+ng)//2
    if mid*mid<=n:
      ok=mid
    else:
      ng=mid
  return ok

def solve():
  n=int(input())
  a=list(map(int,input().split()))
  tmp=1
  for i in a:
    tmp*=i
  s=floor_sqrt(tmp)
  if s*s==tmp:
    print('Yes')
  else:
    print('No')

for _ in range(int(input())):
  solve()
0