結果

問題 No.983 Convolution
ユーザー 👑 tamatotamato
提出日時 2020-02-11 14:33:33
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 109,016 KB
最終ジャッジ日時 2023-07-24 12:25:09
合計ジャッジ時間 5,620 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,000 KB
testcase_01 AC 73 ms
71,216 KB
testcase_02 AC 72 ms
70,744 KB
testcase_03 AC 104 ms
93,084 KB
testcase_04 AC 96 ms
89,380 KB
testcase_05 AC 95 ms
87,420 KB
testcase_06 AC 106 ms
95,728 KB
testcase_07 AC 106 ms
95,364 KB
testcase_08 AC 81 ms
77,596 KB
testcase_09 AC 86 ms
81,768 KB
testcase_10 AC 79 ms
75,752 KB
testcase_11 AC 82 ms
77,624 KB
testcase_12 AC 110 ms
100,724 KB
testcase_13 AC 94 ms
80,544 KB
testcase_14 AC 94 ms
83,348 KB
testcase_15 AC 106 ms
93,056 KB
testcase_16 AC 96 ms
87,056 KB
testcase_17 AC 112 ms
97,932 KB
testcase_18 AC 83 ms
77,380 KB
testcase_19 AC 101 ms
87,460 KB
testcase_20 AC 122 ms
101,320 KB
testcase_21 AC 119 ms
93,956 KB
testcase_22 AC 85 ms
78,180 KB
testcase_23 AC 92 ms
91,972 KB
testcase_24 AC 78 ms
77,160 KB
testcase_25 AC 77 ms
76,664 KB
testcase_26 AC 86 ms
84,868 KB
testcase_27 AC 85 ms
82,352 KB
testcase_28 AC 93 ms
87,832 KB
testcase_29 AC 121 ms
109,016 KB
testcase_30 AC 92 ms
87,688 KB
testcase_31 AC 86 ms
81,124 KB
testcase_32 AC 98 ms
89,576 KB
testcase_33 AC 70 ms
71,176 KB
testcase_34 AC 71 ms
71,208 KB
testcase_35 AC 71 ms
71,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    from math import gcd
    input = sys.stdin.readline

    N = int(input())
    A = list(map(int, input().split()))

    g = 0
    for a in A:
        if a != -1:
            g = gcd(g, a)
    if g != 0:
        print(g**2)
    else:
        print(-1)


if __name__ == '__main__':
    main()
0