結果

問題 No.1884 Sequence
ユーザー shobonvipshobonvip
提出日時 2022-03-25 22:43:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 82,528 KB
実行使用メモリ 130,528 KB
最終ジャッジ日時 2024-04-22 07:27:26
合計ジャッジ時間 6,849 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,224 KB
testcase_01 AC 37 ms
52,736 KB
testcase_02 AC 38 ms
52,352 KB
testcase_03 AC 38 ms
52,224 KB
testcase_04 AC 38 ms
52,224 KB
testcase_05 AC 38 ms
51,584 KB
testcase_06 AC 38 ms
52,224 KB
testcase_07 AC 38 ms
51,968 KB
testcase_08 AC 38 ms
52,352 KB
testcase_09 WA -
testcase_10 AC 183 ms
129,968 KB
testcase_11 AC 183 ms
129,876 KB
testcase_12 AC 68 ms
88,576 KB
testcase_13 AC 70 ms
92,800 KB
testcase_14 AC 76 ms
92,672 KB
testcase_15 AC 118 ms
107,136 KB
testcase_16 AC 151 ms
129,912 KB
testcase_17 AC 98 ms
109,764 KB
testcase_18 AC 106 ms
107,904 KB
testcase_19 AC 98 ms
109,696 KB
testcase_20 AC 114 ms
106,240 KB
testcase_21 AC 104 ms
108,032 KB
testcase_22 AC 119 ms
106,624 KB
testcase_23 AC 154 ms
130,148 KB
testcase_24 AC 154 ms
129,996 KB
testcase_25 AC 153 ms
129,572 KB
testcase_26 AC 154 ms
130,064 KB
testcase_27 AC 76 ms
96,896 KB
testcase_28 AC 75 ms
96,384 KB
testcase_29 AC 74 ms
96,256 KB
testcase_30 AC 73 ms
97,024 KB
testcase_31 AC 105 ms
106,200 KB
testcase_32 WA -
testcase_33 AC 130 ms
129,956 KB
testcase_34 AC 128 ms
129,832 KB
testcase_35 AC 83 ms
101,632 KB
testcase_36 AC 121 ms
114,272 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 143 ms
120,000 KB
testcase_42 AC 146 ms
119,776 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])

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) == max(a):
		print("Yes")
	else:
		print("No")
else:
	targ = (max(b) - min(b))//g - (len(b) - 1)
	if targ <= zeros:
		print("Yes")
	else:
		print("No")
0