結果

問題 No.1884 Sequence
ユーザー shobonvipshobonvip
提出日時 2022-03-25 22:48:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 301 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 133,984 KB
最終ジャッジ日時 2023-08-04 09:50:45
合計ジャッジ時間 8,523 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,256 KB
testcase_01 AC 75 ms
71,400 KB
testcase_02 AC 74 ms
71,456 KB
testcase_03 AC 73 ms
71,316 KB
testcase_04 AC 74 ms
71,276 KB
testcase_05 AC 74 ms
71,408 KB
testcase_06 AC 72 ms
71,012 KB
testcase_07 AC 77 ms
71,440 KB
testcase_08 AC 73 ms
71,464 KB
testcase_09 AC 73 ms
71,192 KB
testcase_10 AC 229 ms
133,680 KB
testcase_11 AC 226 ms
133,984 KB
testcase_12 AC 102 ms
97,672 KB
testcase_13 AC 103 ms
101,036 KB
testcase_14 AC 105 ms
98,608 KB
testcase_15 AC 160 ms
112,448 KB
testcase_16 AC 192 ms
133,820 KB
testcase_17 AC 124 ms
107,072 KB
testcase_18 AC 142 ms
113,836 KB
testcase_19 AC 127 ms
104,580 KB
testcase_20 AC 147 ms
107,960 KB
testcase_21 AC 132 ms
109,136 KB
testcase_22 AC 156 ms
110,740 KB
testcase_23 AC 193 ms
133,612 KB
testcase_24 AC 195 ms
133,688 KB
testcase_25 AC 193 ms
133,016 KB
testcase_26 AC 194 ms
133,860 KB
testcase_27 AC 107 ms
104,268 KB
testcase_28 AC 110 ms
104,344 KB
testcase_29 AC 110 ms
104,492 KB
testcase_30 AC 106 ms
104,372 KB
testcase_31 AC 140 ms
101,604 KB
testcase_32 AC 194 ms
132,648 KB
testcase_33 AC 157 ms
132,092 KB
testcase_34 AC 162 ms
131,976 KB
testcase_35 AC 117 ms
105,548 KB
testcase_36 AC 146 ms
115,768 KB
testcase_37 AC 153 ms
132,264 KB
testcase_38 AC 154 ms
130,780 KB
testcase_39 AC 122 ms
108,032 KB
testcase_40 AC 122 ms
106,676 KB
testcase_41 AC 179 ms
123,684 KB
testcase_42 AC 180 ms
123,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

n = int(input())
a = list(map(int,input().split()))

b = []
c = []
zeros = 0

for i in range(n):
	if a[i] == 0:
		zeros += 1
	else:
		b.append(a[i])

b.sort()
zeromode = 0
for i in range(len(b) - 1):
	c.append(b[i+1] - b[i])
	if b[i+1] - b[i] == 0:
		zeromode = 1

g = 0
for i in c:
	g = math.gcd(g, i)

if g == 0:
	print("Yes")
elif len(b) == 1:
	print("Yes")
elif zeromode == 1:
	if max(b) == min(b):
		print("Yes")
	else:
		print("No")
else:
	targ = (max(b) - min(b))//g - (len(b) - 1)
	if targ <= zeros:
		print("Yes")
	else:
		print("No")
0