結果
問題 | No.2074 Product is Square ? |
ユーザー | ytft |
提出日時 | 2022-09-23 13:48:18 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 523 bytes |
コンパイル時間 | 262 ms |
コンパイル使用メモリ | 87,104 KB |
実行使用メモリ | 90,696 KB |
最終ジャッジ日時 | 2023-08-23 20:49:49 |
合計ジャッジ時間 | 8,290 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
71,380 KB |
testcase_01 | AC | 158 ms
78,640 KB |
testcase_02 | AC | 173 ms
78,744 KB |
testcase_03 | AC | 164 ms
78,780 KB |
testcase_04 | AC | 168 ms
79,620 KB |
testcase_05 | AC | 153 ms
78,776 KB |
testcase_06 | AC | 171 ms
79,360 KB |
testcase_07 | AC | 159 ms
79,524 KB |
testcase_08 | AC | 155 ms
79,528 KB |
testcase_09 | AC | 159 ms
78,856 KB |
testcase_10 | AC | 160 ms
78,932 KB |
testcase_11 | AC | 626 ms
80,088 KB |
testcase_12 | AC | 1,114 ms
80,404 KB |
testcase_13 | TLE | - |
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 | -- | - |
ソースコード
import sys input=lambda:sys.stdin.readline().rstrip() def gcd(a,b): return gcd(a%b,b%a) if min(a,b,abs(a-b)) else max(a,b) def isSquare(a): m,M=0,a+1 while M-m>1: mid=(M+m)//2 if mid**2==a: return 1 elif mid**2<a: m=mid else: M=mid return 0 def solve(): N=int(input()) A=list(map(int,input().split())) for i in range(N): for j in range(i): temp=gcd(A[i],A[j]) A[i]//=temp A[j]//=temp return ["No","Yes"][all([isSquare(i) for i in A])] T=int(input()) for i in range(T): print(solve())