結果

問題 No.2074 Product is Square ?
ユーザー mkawa2mkawa2
提出日時 2022-09-16 22:24:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,609 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 77,016 KB
最終ジャッジ日時 2023-08-23 16:03:14
合計ジャッジ時間 4,893 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,500 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 84 ms
76,788 KB
testcase_12 WA -
testcase_13 AC 82 ms
76,700 KB
testcase_14 WA -
testcase_15 AC 83 ms
76,600 KB
testcase_16 WA -
testcase_17 AC 81 ms
76,636 KB
testcase_18 WA -
testcase_19 AC 85 ms
76,692 KB
testcase_20 WA -
testcase_21 AC 82 ms
76,496 KB
testcase_22 WA -
testcase_23 AC 87 ms
76,696 KB
testcase_24 WA -
testcase_25 AC 84 ms
76,688 KB
testcase_26 WA -
testcase_27 AC 85 ms
76,576 KB
testcase_28 WA -
testcase_29 AC 84 ms
76,460 KB
testcase_30 WA -
testcase_31 AC 74 ms
71,468 KB
testcase_32 AC 71 ms
71,352 KB
testcase_33 AC 90 ms
77,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = (1 << 63)-1
# inf = (1 << 31)-1
md = 10**9+7
# md = 998244353

rr = [{0, 1, 4}, {0, 1, 2, 4}, {0, 1, 4, 7}, {0, 1, 3, 4, 9, 10, 12}, {0, 1, 2, 4, 8, 9, 13, 15, 16},
      {0, 1, 2, 3, 4, 6, 8, 9, 11, 12, 16, 18, 22, 24, 25, 27, 31, 32, 33, 35, 36, 43, 44, 47, 48, 49, 50, 53, 54, 61,
       62, 64, 65, 66, 70, 72, 73, 75, 79, 81, 85, 86, 88, 89, 91, 93, 94, 95, 96},
      {0, 1, 129, 4, 132, 9, 137, 16, 144, 17, 145, 25, 153, 33, 161, 36, 164, 169, 41, 49, 177, 185, 57, 64, 193, 65,
       196, 68, 73, 201, 81, 209, 217, 89, 225, 97, 100, 228, 249, 105, 233, 113, 241, 121}]
mm = [5, 7, 9, 13, 17, 97, 256]

def solve():
    def ok():
        for i, s in enumerate(ss):
            if s not in rr[i]: return False
        return True

    n = II()
    aa = LI()
    ss = [1]*7
    for a in aa:
        for i, m in enumerate(mm):
            ss[i] *= a
            ss[i] %= m
    print("Yes" if ok() else "No")

for _ in range(II()):
    solve()
0