結果
| 問題 |
No.2074 Product is Square ?
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-16 21:49:17 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 883 bytes |
| コンパイル時間 | 863 ms |
| コンパイル使用メモリ | 81,792 KB |
| 実行使用メモリ | 157,312 KB |
| 最終ジャッジ日時 | 2024-12-21 19:06:15 |
| 合計ジャッジ時間 | 62,516 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 TLE * 20 |
ソースコード
import sys, random
input = lambda : sys.stdin.readline().rstrip()
write = lambda x: sys.stdout.write(x+"\n"); writef = lambda x: print("{:.12f}".format(x))
debug = lambda x: sys.stderr.write(x+"\n")
YES="Yes"; NO="No"; pans = lambda v: print(YES if v else NO); INF=10**18
LI = lambda : list(map(int, input().split())); II=lambda : int(input())
def debug(_l_):
for s in _l_.split():
print(f"{s}={eval(s)}", end=" ")
print()
def dlist(*l, fill=0):
if len(l)==1:
return [fill]*l[0]
ll = l[1:]
return [dlist(*ll, fill=fill) for _ in range(l[0])]
def isqrt(n):
"""x*x<=nなる最大のx
"""
x,y = n, (n+1)//2
while y<x:
x,y = y, (y + n//y) // 2
return x
t = II()
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
v = 1
for val in a:
v *= val
t = isqrt(v)
pans(t*t==v)