結果

問題 No.1884 Sequence
ユーザー k_o_pasturek_o_pasture
提出日時 2022-03-25 22:25:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 443 ms / 2,000 ms
コード長 557 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,312 KB
最終ジャッジ日時 2024-04-22 07:08:31
合計ジャッジ時間 9,992 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 32 ms
10,880 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,880 KB
testcase_05 AC 31 ms
11,008 KB
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 31 ms
10,880 KB
testcase_08 AC 31 ms
11,008 KB
testcase_09 AC 31 ms
10,880 KB
testcase_10 AC 425 ms
34,284 KB
testcase_11 AC 417 ms
34,284 KB
testcase_12 AC 87 ms
13,560 KB
testcase_13 AC 93 ms
13,948 KB
testcase_14 AC 93 ms
14,276 KB
testcase_15 AC 288 ms
23,268 KB
testcase_16 AC 429 ms
34,280 KB
testcase_17 AC 161 ms
20,572 KB
testcase_18 AC 216 ms
24,676 KB
testcase_19 AC 173 ms
21,552 KB
testcase_20 AC 237 ms
21,092 KB
testcase_21 AC 186 ms
19,476 KB
testcase_22 AC 259 ms
22,088 KB
testcase_23 AC 443 ms
32,736 KB
testcase_24 AC 432 ms
34,288 KB
testcase_25 AC 415 ms
32,740 KB
testcase_26 AC 438 ms
34,260 KB
testcase_27 AC 100 ms
14,792 KB
testcase_28 AC 102 ms
14,792 KB
testcase_29 AC 102 ms
14,916 KB
testcase_30 AC 103 ms
14,792 KB
testcase_31 AC 196 ms
21,264 KB
testcase_32 AC 343 ms
33,072 KB
testcase_33 AC 194 ms
34,312 KB
testcase_34 AC 192 ms
34,312 KB
testcase_35 AC 118 ms
15,912 KB
testcase_36 AC 186 ms
26,528 KB
testcase_37 AC 194 ms
34,312 KB
testcase_38 AC 189 ms
34,044 KB
testcase_39 AC 138 ms
18,628 KB
testcase_40 AC 146 ms
19,536 KB
testcase_41 AC 368 ms
28,844 KB
testcase_42 AC 366 ms
28,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import *

N = int(input())
A = sorted(list(map(int, input().split())))

c = 0 # 0 の数
B = []
for a in A:
	if a == 0:
		c += 1
	else:
		B.append(a)
# print('c',c)
# print('B',B)

D = [] # 差

for i in range(1,len(B)):
	D.append(B[i]-B[i-1])
# print('D',D)

for d in D:
	if d == 0:
		if len(D) == len([d for d in D if d == 0]):
			print('Yes')
			exit()
		else:
			print('No')
			exit()

G = gcd(*D) # 差の最大公約数
# print('G',G)
s = 0
for d in D:
	s += (d // G) - 1
# print('s',s)
if c >= s and s >= 0:
	print('Yes')
else:
	print('No')
0