結果

問題 No.1884 Sequence
ユーザー brthyyjpbrthyyjp
提出日時 2022-03-27 09:42:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 503 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 149,968 KB
最終ジャッジ日時 2024-04-23 22:33:23
合計ジャッジ時間 6,526 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,072 KB
testcase_01 AC 38 ms
52,352 KB
testcase_02 AC 41 ms
52,352 KB
testcase_03 AC 40 ms
51,968 KB
testcase_04 AC 40 ms
52,224 KB
testcase_05 AC 39 ms
51,968 KB
testcase_06 AC 38 ms
51,584 KB
testcase_07 AC 40 ms
52,096 KB
testcase_08 AC 41 ms
52,352 KB
testcase_09 AC 38 ms
51,840 KB
testcase_10 AC 215 ms
149,324 KB
testcase_11 AC 204 ms
149,556 KB
testcase_12 AC 65 ms
89,308 KB
testcase_13 AC 66 ms
92,416 KB
testcase_14 AC 73 ms
92,120 KB
testcase_15 AC 133 ms
108,160 KB
testcase_16 AC 179 ms
149,556 KB
testcase_17 AC 96 ms
110,024 KB
testcase_18 AC 111 ms
109,000 KB
testcase_19 AC 101 ms
109,392 KB
testcase_20 AC 120 ms
106,948 KB
testcase_21 AC 111 ms
115,028 KB
testcase_22 AC 127 ms
107,784 KB
testcase_23 AC 180 ms
149,252 KB
testcase_24 AC 174 ms
149,320 KB
testcase_25 AC 179 ms
148,280 KB
testcase_26 AC 182 ms
149,968 KB
testcase_27 AC 77 ms
96,516 KB
testcase_28 AC 77 ms
96,492 KB
testcase_29 AC 74 ms
96,948 KB
testcase_30 AC 75 ms
96,748 KB
testcase_31 AC 113 ms
106,612 KB
testcase_32 AC 178 ms
148,912 KB
testcase_33 AC 106 ms
116,396 KB
testcase_34 AC 106 ms
116,360 KB
testcase_35 AC 83 ms
100,012 KB
testcase_36 AC 116 ms
106,836 KB
testcase_37 AC 112 ms
116,468 KB
testcase_38 AC 111 ms
114,780 KB
testcase_39 AC 97 ms
105,148 KB
testcase_40 AC 95 ms
107,480 KB
testcase_41 AC 159 ms
133,868 KB
testcase_42 AC 163 ms
132,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = list(map(int, input().split()))
A.sort()
z = 0
B = []
for a in A:
    if a == 0:
        z += 1
    else:
        B.append(a)

if len(set(B)) <= 1:
    print('Yes')
    exit()

import math
d = 0

B.sort()
for i in range(len(B)-1):
    d = math.gcd(d, B[i+1]-B[i])

if d == 0:
    print('Yes')
    exit()

cnt = 0
for i in range(len(B)-1):
    if B[i+1]-B[i] == 0:
        print('No')
        exit()
    cnt += (B[i+1]-B[i])//d-1

if cnt <= z:
    print('Yes')
else:
    print('No')
0