結果

問題 No.2074 Product is Square ?
ユーザー roarisroaris
提出日時 2022-09-16 23:47:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 569 ms / 2,000 ms
コード長 614 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 87,228 KB
実行使用メモリ 78,180 KB
最終ジャッジ日時 2023-08-23 17:03:50
合計ジャッジ時間 11,888 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 94 ms
71,684 KB
testcase_01 AC 117 ms
78,080 KB
testcase_02 AC 119 ms
78,096 KB
testcase_03 AC 115 ms
78,164 KB
testcase_04 AC 115 ms
77,972 KB
testcase_05 AC 114 ms
78,052 KB
testcase_06 AC 117 ms
78,076 KB
testcase_07 AC 115 ms
78,160 KB
testcase_08 AC 121 ms
78,048 KB
testcase_09 AC 121 ms
77,876 KB
testcase_10 AC 120 ms
78,132 KB
testcase_11 AC 385 ms
78,144 KB
testcase_12 AC 366 ms
77,788 KB
testcase_13 AC 569 ms
78,168 KB
testcase_14 AC 393 ms
78,068 KB
testcase_15 AC 387 ms
78,000 KB
testcase_16 AC 364 ms
77,704 KB
testcase_17 AC 569 ms
77,812 KB
testcase_18 AC 394 ms
78,032 KB
testcase_19 AC 384 ms
78,004 KB
testcase_20 AC 364 ms
78,084 KB
testcase_21 AC 564 ms
78,168 KB
testcase_22 AC 395 ms
78,036 KB
testcase_23 AC 385 ms
77,976 KB
testcase_24 AC 364 ms
78,180 KB
testcase_25 AC 561 ms
78,084 KB
testcase_26 AC 386 ms
77,968 KB
testcase_27 AC 387 ms
78,076 KB
testcase_28 AC 367 ms
77,856 KB
testcase_29 AC 569 ms
78,092 KB
testcase_30 AC 395 ms
77,648 KB
testcase_31 AC 102 ms
76,932 KB
testcase_32 AC 90 ms
71,420 KB
testcase_33 AC 117 ms
77,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *
from math import gcd



for _ in range(int(input())):
    N = int(input())
    A = list(map(int, input().split()))
    
    for i in range(N):
        for j in range(i+1, N):
            G = gcd(A[i], A[j])
            A[i] //= G
            A[j] //= G
    
    for Ai in A:
        l, r = 0, Ai
    
        while l<=r:
            m = (l+r)//2
            
            if m*m<=Ai:
                l = m+1
            else:
                r = m-1
        
        if r*r!=Ai:
            print('No')
            break
    else:
        print('Yes')
0