結果

問題 No.2074 Product is Square ?
ユーザー shotoyooshotoyoo
提出日時 2022-09-16 21:49:17
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 883 bytes
コンパイル時間 868 ms
コンパイル使用メモリ 86,540 KB
実行使用メモリ 90,916 KB
最終ジャッジ日時 2023-08-23 14:55:30
合計ジャッジ時間 5,777 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
76,860 KB
testcase_01 AC 125 ms
78,036 KB
testcase_02 AC 123 ms
77,812 KB
testcase_03 AC 121 ms
77,800 KB
testcase_04 AC 134 ms
78,388 KB
testcase_05 AC 123 ms
77,568 KB
testcase_06 AC 123 ms
77,732 KB
testcase_07 AC 123 ms
77,836 KB
testcase_08 AC 122 ms
77,456 KB
testcase_09 AC 122 ms
77,488 KB
testcase_10 AC 128 ms
78,828 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0