結果

問題 No.1884 Sequence
ユーザー square1001square1001
提出日時 2022-03-25 21:27:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 372 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 373 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,404 KB
最終ジャッジ日時 2024-04-22 06:01:41
合計ジャッジ時間 9,019 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 30 ms
10,880 KB
testcase_02 AC 30 ms
10,880 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 30 ms
10,880 KB
testcase_05 AC 31 ms
10,880 KB
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 30 ms
10,880 KB
testcase_09 AC 32 ms
10,880 KB
testcase_10 AC 359 ms
34,404 KB
testcase_11 AC 359 ms
34,400 KB
testcase_12 AC 71 ms
13,548 KB
testcase_13 AC 77 ms
13,932 KB
testcase_14 AC 74 ms
14,380 KB
testcase_15 AC 225 ms
23,252 KB
testcase_16 AC 361 ms
34,272 KB
testcase_17 AC 130 ms
20,688 KB
testcase_18 AC 181 ms
24,660 KB
testcase_19 AC 147 ms
21,480 KB
testcase_20 AC 187 ms
20,948 KB
testcase_21 AC 146 ms
19,416 KB
testcase_22 AC 205 ms
22,204 KB
testcase_23 AC 369 ms
33,644 KB
testcase_24 AC 363 ms
34,268 KB
testcase_25 AC 363 ms
33,644 KB
testcase_26 AC 372 ms
34,252 KB
testcase_27 AC 83 ms
14,904 KB
testcase_28 AC 81 ms
14,776 KB
testcase_29 AC 82 ms
14,772 KB
testcase_30 AC 81 ms
14,904 KB
testcase_31 AC 193 ms
21,120 KB
testcase_32 AC 353 ms
33,016 KB
testcase_33 AC 139 ms
34,304 KB
testcase_34 AC 141 ms
34,308 KB
testcase_35 AC 89 ms
15,688 KB
testcase_36 AC 124 ms
26,640 KB
testcase_37 AC 235 ms
34,304 KB
testcase_38 AC 238 ms
34,032 KB
testcase_39 AC 117 ms
18,736 KB
testcase_40 AC 128 ms
19,520 KB
testcase_41 AC 295 ms
28,828 KB
testcase_42 AC 305 ms
28,956 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

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

v = []
for i in A:
	if i != 0:
		v.append(i)

v.sort()
if len(v) == 0:
	print("Yes")
elif v[0] == v[-1]:
	print("Yes")
else:
	g = v[1] - v[0]
	flag = True
	for i in range(1, len(v)):
		g = math.gcd(g, v[i] - v[i - 1])
		if v[i] == v[i - 1]:
			flag = False
	if not flag:
		print("No")
	elif (v[-1] - v[0]) // g <= N - 1:
		print("Yes")
	else:
		print("No")
0