結果

問題 No.1884 Sequence
ユーザー puznekopuzneko
提出日時 2022-04-05 23:21:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 123,396 KB
最終ジャッジ日時 2023-08-18 05:22:16
合計ジャッジ時間 11,264 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,540 KB
testcase_01 AC 73 ms
71,312 KB
testcase_02 AC 71 ms
71,336 KB
testcase_03 AC 74 ms
71,408 KB
testcase_04 AC 74 ms
71,104 KB
testcase_05 AC 73 ms
71,388 KB
testcase_06 AC 71 ms
71,336 KB
testcase_07 AC 69 ms
71,316 KB
testcase_08 AC 73 ms
71,368 KB
testcase_09 AC 74 ms
71,248 KB
testcase_10 AC 219 ms
120,564 KB
testcase_11 AC 215 ms
120,724 KB
testcase_12 AC 107 ms
102,080 KB
testcase_13 AC 111 ms
105,620 KB
testcase_14 AC 111 ms
102,736 KB
testcase_15 AC 154 ms
115,432 KB
testcase_16 AC 177 ms
121,000 KB
testcase_17 AC 127 ms
113,324 KB
testcase_18 AC 138 ms
123,396 KB
testcase_19 AC 131 ms
116,800 KB
testcase_20 AC 145 ms
114,132 KB
testcase_21 AC 138 ms
114,864 KB
testcase_22 AC 153 ms
120,012 KB
testcase_23 AC 178 ms
120,736 KB
testcase_24 AC 178 ms
120,544 KB
testcase_25 AC 180 ms
119,916 KB
testcase_26 AC 178 ms
120,336 KB
testcase_27 AC 114 ms
109,512 KB
testcase_28 AC 115 ms
109,568 KB
testcase_29 AC 113 ms
109,712 KB
testcase_30 AC 113 ms
109,748 KB
testcase_31 AC 140 ms
114,196 KB
testcase_32 AC 176 ms
120,040 KB
testcase_33 AC 140 ms
120,552 KB
testcase_34 AC 140 ms
120,628 KB
testcase_35 AC 122 ms
111,308 KB
testcase_36 AC 136 ms
117,112 KB
testcase_37 AC 140 ms
120,948 KB
testcase_38 AC 139 ms
119,132 KB
testcase_39 AC 126 ms
114,072 KB
testcase_40 AC 125 ms
115,304 KB
testcase_41 AC 169 ms
118,308 KB
testcase_42 AC 169 ms
118,080 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from sys import stdin
n, *a = map(int, stdin.read().split())
b = []
for i in range(n):
    if a[i] != 0:
        b.append(a[i])

m = len(b)
if m <= 2:
    print("Yes")
    exit()

b.sort()
c = [b[i+1]-b[i] for i in range(m-1)]
bgcd = c[0]
for i in range(m-1):
    if c[i] == 0:
        bgcd = 0
        break
    bgcd = math.gcd(bgcd,c[i])

if bgcd == 0:
    if max(b) != min(b):
        print("No")
    else:
        print("Yes")
else:
    if (max(b) - min(b)) >= bgcd * n:
        print("No")
    else:
        print("Yes")
0