結果

問題 No.1884 Sequence
ユーザー KudeKude
提出日時 2022-03-25 21:28:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 141,204 KB
最終ジャッジ日時 2024-04-22 06:04:05
合計ジャッジ時間 6,171 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,712 KB
testcase_01 AC 41 ms
52,352 KB
testcase_02 AC 41 ms
51,968 KB
testcase_03 AC 38 ms
51,712 KB
testcase_04 AC 39 ms
51,584 KB
testcase_05 AC 38 ms
51,840 KB
testcase_06 AC 38 ms
51,968 KB
testcase_07 AC 38 ms
52,096 KB
testcase_08 AC 38 ms
51,968 KB
testcase_09 AC 37 ms
52,352 KB
testcase_10 AC 222 ms
140,364 KB
testcase_11 AC 220 ms
141,204 KB
testcase_12 AC 60 ms
76,928 KB
testcase_13 AC 63 ms
80,000 KB
testcase_14 AC 68 ms
80,896 KB
testcase_15 AC 138 ms
107,904 KB
testcase_16 AC 181 ms
140,388 KB
testcase_17 AC 97 ms
105,600 KB
testcase_18 AC 120 ms
110,828 KB
testcase_19 AC 104 ms
111,232 KB
testcase_20 AC 118 ms
98,944 KB
testcase_21 AC 104 ms
102,400 KB
testcase_22 AC 122 ms
100,352 KB
testcase_23 AC 185 ms
140,184 KB
testcase_24 AC 186 ms
140,904 KB
testcase_25 AC 186 ms
139,648 KB
testcase_26 AC 189 ms
141,004 KB
testcase_27 AC 63 ms
81,664 KB
testcase_28 AC 66 ms
82,176 KB
testcase_29 AC 65 ms
82,688 KB
testcase_30 AC 63 ms
82,560 KB
testcase_31 AC 104 ms
106,880 KB
testcase_32 AC 171 ms
135,400 KB
testcase_33 AC 109 ms
104,368 KB
testcase_34 AC 106 ms
104,036 KB
testcase_35 AC 68 ms
84,480 KB
testcase_36 AC 103 ms
101,760 KB
testcase_37 AC 115 ms
104,156 KB
testcase_38 AC 108 ms
102,196 KB
testcase_39 AC 73 ms
89,216 KB
testcase_40 AC 75 ms
90,496 KB
testcase_41 AC 165 ms
122,764 KB
testcase_42 AC 166 ms
123,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
n = int(input())
a = []
k = 0
for x in map(int, input().split()):
    if x == 0:
        k += 1
    else:
        a.append(x)
a = sorted(a)
ls = len(set(a))
n = len(a)
if ls == 1:
    print('Yes')
    exit()
elif ls != n:
    print('No')
    exit()
g = 0
for x, y in zip(a, a[1:]):
    g = gcd(g, y - x)
r = sum((y - x) // g - 1 for x, y in zip(a, a[1:]))
print('Yes' if r <= k else 'No')
0