結果

問題 No.1884 Sequence
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-03-25 22:39:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 307 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 144,344 KB
最終ジャッジ日時 2023-08-04 09:38:50
合計ジャッジ時間 7,684 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,452 KB
testcase_01 AC 63 ms
71,576 KB
testcase_02 AC 65 ms
71,744 KB
testcase_03 AC 66 ms
71,680 KB
testcase_04 AC 72 ms
71,220 KB
testcase_05 AC 63 ms
71,300 KB
testcase_06 AC 64 ms
71,440 KB
testcase_07 AC 66 ms
71,308 KB
testcase_08 AC 65 ms
71,368 KB
testcase_09 AC 64 ms
71,120 KB
testcase_10 AC 218 ms
143,928 KB
testcase_11 AC 222 ms
144,176 KB
testcase_12 AC 91 ms
99,324 KB
testcase_13 AC 92 ms
102,300 KB
testcase_14 AC 98 ms
99,632 KB
testcase_15 AC 155 ms
118,396 KB
testcase_16 AC 174 ms
143,612 KB
testcase_17 AC 118 ms
109,032 KB
testcase_18 AC 139 ms
120,652 KB
testcase_19 AC 119 ms
107,316 KB
testcase_20 AC 139 ms
108,816 KB
testcase_21 AC 132 ms
115,940 KB
testcase_22 AC 151 ms
116,108 KB
testcase_23 AC 178 ms
143,780 KB
testcase_24 AC 182 ms
143,764 KB
testcase_25 AC 179 ms
143,088 KB
testcase_26 AC 185 ms
144,344 KB
testcase_27 AC 97 ms
105,768 KB
testcase_28 AC 98 ms
105,696 KB
testcase_29 AC 98 ms
106,132 KB
testcase_30 AC 100 ms
105,808 KB
testcase_31 AC 133 ms
104,440 KB
testcase_32 AC 184 ms
141,664 KB
testcase_33 AC 119 ms
107,084 KB
testcase_34 AC 114 ms
107,008 KB
testcase_35 AC 100 ms
106,276 KB
testcase_36 AC 124 ms
102,560 KB
testcase_37 AC 125 ms
108,912 KB
testcase_38 AC 116 ms
107,376 KB
testcase_39 AC 107 ms
108,276 KB
testcase_40 AC 111 ms
109,124 KB
testcase_41 AC 170 ms
131,136 KB
testcase_42 AC 175 ms
130,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
n = int(input())
A = sorted(list(map(int,input().split())))
zero = 0
nA = [0]
for i in range(n):
    if A[i] != 0:
        nA = A[i:]
        zero = i
        break

if len(set(nA))== 1:
    print("Yes")
    exit()

g = nA[1]-nA[0]
for a,na in zip(nA,nA[1:]):
    dif = na-a
    if dif == 0:
        print("No")
        exit()
    g = gcd(dif,g)


for a,na in zip(nA,nA[1:]):
    dif = na-a
    zero -= (dif//g)-1

print("Yes" if zero >= 0 else "No")
0