結果

問題 No.1884 Sequence
ユーザー square1001square1001
提出日時 2022-03-25 21:27:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 300 ms / 2,000 ms
コード長 423 bytes
コンパイル時間 138 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 31,868 KB
最終ジャッジ日時 2023-08-04 08:11:43
合計ジャッジ時間 8,066 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,964 KB
testcase_01 AC 15 ms
7,940 KB
testcase_02 AC 15 ms
7,936 KB
testcase_03 AC 14 ms
7,936 KB
testcase_04 AC 15 ms
7,940 KB
testcase_05 AC 14 ms
7,960 KB
testcase_06 AC 14 ms
7,948 KB
testcase_07 AC 14 ms
8,048 KB
testcase_08 AC 15 ms
8,084 KB
testcase_09 AC 15 ms
8,052 KB
testcase_10 AC 284 ms
31,664 KB
testcase_11 AC 281 ms
29,984 KB
testcase_12 AC 47 ms
10,876 KB
testcase_13 AC 52 ms
11,100 KB
testcase_14 AC 52 ms
11,308 KB
testcase_15 AC 182 ms
20,592 KB
testcase_16 AC 285 ms
31,868 KB
testcase_17 AC 98 ms
17,740 KB
testcase_18 AC 148 ms
21,960 KB
testcase_19 AC 116 ms
18,880 KB
testcase_20 AC 138 ms
18,404 KB
testcase_21 AC 110 ms
16,804 KB
testcase_22 AC 158 ms
19,636 KB
testcase_23 AC 295 ms
30,008 KB
testcase_24 AC 289 ms
31,680 KB
testcase_25 AC 289 ms
29,976 KB
testcase_26 AC 300 ms
30,140 KB
testcase_27 AC 57 ms
11,580 KB
testcase_28 AC 61 ms
11,608 KB
testcase_29 AC 59 ms
11,420 KB
testcase_30 AC 56 ms
11,652 KB
testcase_31 AC 145 ms
18,548 KB
testcase_32 AC 287 ms
30,476 KB
testcase_33 AC 104 ms
30,076 KB
testcase_34 AC 104 ms
30,120 KB
testcase_35 AC 60 ms
13,452 KB
testcase_36 AC 97 ms
24,060 KB
testcase_37 AC 212 ms
30,136 KB
testcase_38 AC 206 ms
30,144 KB
testcase_39 AC 94 ms
17,300 KB
testcase_40 AC 100 ms
17,084 KB
testcase_41 AC 246 ms
25,252 KB
testcase_42 AC 243 ms
25,268 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