結果

問題 No.1884 Sequence
ユーザー hir355hir355
提出日時 2022-03-25 21:34:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 594 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,884 KB
実行使用メモリ 120,188 KB
最終ジャッジ日時 2023-08-04 08:24:09
合計ジャッジ時間 7,320 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,496 KB
testcase_01 AC 64 ms
71,420 KB
testcase_02 AC 64 ms
71,476 KB
testcase_03 AC 66 ms
71,196 KB
testcase_04 AC 65 ms
71,240 KB
testcase_05 AC 64 ms
71,184 KB
testcase_06 AC 64 ms
71,308 KB
testcase_07 AC 65 ms
71,560 KB
testcase_08 AC 64 ms
71,332 KB
testcase_09 AC 65 ms
71,192 KB
testcase_10 AC 197 ms
119,820 KB
testcase_11 AC 193 ms
120,028 KB
testcase_12 AC 91 ms
98,284 KB
testcase_13 AC 93 ms
101,024 KB
testcase_14 AC 95 ms
98,424 KB
testcase_15 AC 145 ms
105,956 KB
testcase_16 AC 171 ms
119,900 KB
testcase_17 AC 109 ms
107,192 KB
testcase_18 AC 126 ms
106,824 KB
testcase_19 AC 113 ms
104,704 KB
testcase_20 AC 126 ms
107,904 KB
testcase_21 AC 122 ms
108,896 KB
testcase_22 AC 141 ms
105,224 KB
testcase_23 AC 168 ms
119,796 KB
testcase_24 AC 166 ms
120,188 KB
testcase_25 AC 170 ms
119,272 KB
testcase_26 AC 168 ms
120,044 KB
testcase_27 AC 95 ms
104,244 KB
testcase_28 AC 99 ms
104,628 KB
testcase_29 AC 98 ms
104,588 KB
testcase_30 AC 98 ms
104,452 KB
testcase_31 AC 120 ms
101,772 KB
testcase_32 AC 162 ms
119,008 KB
testcase_33 AC 127 ms
118,164 KB
testcase_34 AC 127 ms
118,040 KB
testcase_35 AC 101 ms
105,116 KB
testcase_36 AC 125 ms
107,500 KB
testcase_37 AC 129 ms
118,236 KB
testcase_38 AC 129 ms
116,820 KB
testcase_39 AC 120 ms
107,604 KB
testcase_40 AC 111 ms
107,004 KB
testcase_41 AC 155 ms
113,248 KB
testcase_42 AC 158 ms
113,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
n = int(input())
a = list(map(int, input().split()))
b = []
cnt = 0
for x in a:
    if x == 0:
        cnt += 1
    else:
        b.append(x)
b.sort()
if len(b) <= 1:
    print('Yes')
else:
    g = b[1] - b[0]
    for i in range(len(b) - 1):
        if b[i + 1] - b[i] == 0:
            g = 0
            break
        else:
            g = gcd(g, b[i + 1] - b[i])
    if g == 0:
        if b[-1] - b[0] == 0:
            print('Yes')
        else:
            print('No')
    elif (b[-1] - b[0]) // g + 1 - len(b) <= cnt:
        print('Yes')
    else:
        print('No')
0