結果

問題 No.2074 Product is Square ?
ユーザー chineristACchineristAC
提出日時 2022-09-14 09:48:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 585 ms / 2,000 ms
コード長 881 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 80,168 KB
最終ジャッジ日時 2023-08-21 12:39:16
合計ジャッジ時間 12,786 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
74,616 KB
testcase_01 AC 137 ms
79,484 KB
testcase_02 AC 134 ms
79,008 KB
testcase_03 AC 137 ms
79,428 KB
testcase_04 AC 128 ms
79,396 KB
testcase_05 AC 127 ms
79,664 KB
testcase_06 AC 130 ms
79,508 KB
testcase_07 AC 128 ms
79,544 KB
testcase_08 AC 126 ms
79,568 KB
testcase_09 AC 128 ms
79,492 KB
testcase_10 AC 125 ms
79,448 KB
testcase_11 AC 408 ms
79,768 KB
testcase_12 AC 378 ms
79,628 KB
testcase_13 AC 585 ms
80,168 KB
testcase_14 AC 405 ms
79,284 KB
testcase_15 AC 407 ms
79,640 KB
testcase_16 AC 380 ms
79,560 KB
testcase_17 AC 583 ms
80,140 KB
testcase_18 AC 404 ms
79,648 KB
testcase_19 AC 399 ms
79,584 KB
testcase_20 AC 379 ms
79,164 KB
testcase_21 AC 579 ms
80,016 KB
testcase_22 AC 414 ms
79,576 KB
testcase_23 AC 408 ms
79,616 KB
testcase_24 AC 386 ms
79,584 KB
testcase_25 AC 580 ms
79,492 KB
testcase_26 AC 410 ms
79,388 KB
testcase_27 AC 401 ms
79,456 KB
testcase_28 AC 384 ms
79,824 KB
testcase_29 AC 578 ms
79,584 KB
testcase_30 AC 409 ms
79,596 KB
testcase_31 AC 113 ms
74,196 KB
testcase_32 AC 112 ms
74,724 KB
testcase_33 AC 132 ms
79,700 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,random,bisect
from collections import deque,defaultdict
from heapq import heapify,heappop,heappush
from itertools import permutations
from math import log,gcd

input = lambda :sys.stdin.readline()
mi = lambda :map(int,input().split())
li = lambda :list(mi())

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

def solve(N,A):
    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 a in A:
        t = int(a**.5)
        for s in range(t-2,t+2):
            if s**2 == a:
                break
        else:
            return False
    return True

for _ in range(int(input())):
    N = int(input())
    A = li()
    print("Yes" if solve(N,A) else "No")
0