結果

問題 No.1884 Sequence
ユーザー shobonvipshobonvip
提出日時 2022-03-25 22:48:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 132,096 KB
最終ジャッジ日時 2024-04-22 07:34:53
合計ジャッジ時間 6,868 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,352 KB
testcase_01 AC 41 ms
52,008 KB
testcase_02 AC 40 ms
52,224 KB
testcase_03 AC 41 ms
52,608 KB
testcase_04 AC 41 ms
52,096 KB
testcase_05 AC 43 ms
52,352 KB
testcase_06 AC 41 ms
52,224 KB
testcase_07 AC 41 ms
52,608 KB
testcase_08 AC 42 ms
52,352 KB
testcase_09 AC 41 ms
52,352 KB
testcase_10 AC 212 ms
131,484 KB
testcase_11 AC 207 ms
131,616 KB
testcase_12 AC 72 ms
89,088 KB
testcase_13 AC 74 ms
92,152 KB
testcase_14 AC 78 ms
91,648 KB
testcase_15 AC 131 ms
108,032 KB
testcase_16 AC 175 ms
131,296 KB
testcase_17 AC 105 ms
109,184 KB
testcase_18 AC 114 ms
107,468 KB
testcase_19 AC 105 ms
108,672 KB
testcase_20 AC 123 ms
107,008 KB
testcase_21 AC 110 ms
108,416 KB
testcase_22 AC 128 ms
106,752 KB
testcase_23 AC 176 ms
131,624 KB
testcase_24 AC 176 ms
132,096 KB
testcase_25 AC 175 ms
130,656 KB
testcase_26 AC 178 ms
131,932 KB
testcase_27 AC 79 ms
97,152 KB
testcase_28 AC 78 ms
97,152 KB
testcase_29 AC 79 ms
96,896 KB
testcase_30 AC 80 ms
96,256 KB
testcase_31 AC 121 ms
106,516 KB
testcase_32 AC 176 ms
130,424 KB
testcase_33 AC 137 ms
130,120 KB
testcase_34 AC 137 ms
130,084 KB
testcase_35 AC 90 ms
102,272 KB
testcase_36 AC 128 ms
114,992 KB
testcase_37 AC 140 ms
129,700 KB
testcase_38 AC 138 ms
128,372 KB
testcase_39 AC 102 ms
108,800 KB
testcase_40 AC 104 ms
107,880 KB
testcase_41 AC 161 ms
120,540 KB
testcase_42 AC 167 ms
120,312 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