結果

問題 No.2074 Product is Square ?
ユーザー lilictakalilictaka
提出日時 2022-09-19 21:22:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 541 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 77,744 KB
最終ジャッジ日時 2023-08-23 19:06:15
合計ジャッジ時間 11,711 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,528 KB
testcase_01 AC 96 ms
76,832 KB
testcase_02 AC 87 ms
76,872 KB
testcase_03 AC 92 ms
76,888 KB
testcase_04 AC 93 ms
76,632 KB
testcase_05 AC 94 ms
76,920 KB
testcase_06 AC 93 ms
76,884 KB
testcase_07 AC 87 ms
76,796 KB
testcase_08 AC 88 ms
76,716 KB
testcase_09 AC 91 ms
76,844 KB
testcase_10 AC 87 ms
76,836 KB
testcase_11 AC 361 ms
77,012 KB
testcase_12 AC 338 ms
77,020 KB
testcase_13 AC 536 ms
76,808 KB
testcase_14 AC 363 ms
76,948 KB
testcase_15 AC 360 ms
76,916 KB
testcase_16 AC 343 ms
77,012 KB
testcase_17 AC 537 ms
76,896 KB
testcase_18 AC 364 ms
76,976 KB
testcase_19 AC 366 ms
76,864 KB
testcase_20 AC 345 ms
76,864 KB
testcase_21 AC 541 ms
76,952 KB
testcase_22 AC 369 ms
77,004 KB
testcase_23 AC 362 ms
76,688 KB
testcase_24 AC 340 ms
76,708 KB
testcase_25 AC 536 ms
76,920 KB
testcase_26 AC 365 ms
76,720 KB
testcase_27 AC 360 ms
76,940 KB
testcase_28 AC 340 ms
76,920 KB
testcase_29 AC 533 ms
76,616 KB
testcase_30 AC 365 ms
76,616 KB
testcase_31 AC 75 ms
71,212 KB
testcase_32 AC 73 ms
71,300 KB
testcase_33 AC 113 ms
77,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd,sqrt
def all(List):
    for a in List:
        if a == int(sqrt(a)) ** 2:
            pass
        else:
            return False
    return True
T = int(input())
for _ in range(T):
    N = int(input())
    A = list(map(int,input().split()))
    for i in range(N):
        for k in range(i+1,N):
            g = gcd(A[i],A[k])
            A[i]//= g
            A[k]//=g
    if all(A):
        print('Yes')
    else:
        print('No')
0