結果

問題 No.1884 Sequence
ユーザー ytftytft
提出日時 2022-03-28 16:03:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 168 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 243 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 109,880 KB
最終ジャッジ日時 2024-04-24 22:27:33
合計ジャッジ時間 6,600 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,224 KB
testcase_01 AC 42 ms
52,096 KB
testcase_02 AC 42 ms
52,224 KB
testcase_03 AC 41 ms
52,352 KB
testcase_04 AC 41 ms
52,224 KB
testcase_05 AC 41 ms
51,968 KB
testcase_06 AC 43 ms
52,096 KB
testcase_07 AC 43 ms
52,224 KB
testcase_08 AC 42 ms
51,840 KB
testcase_09 AC 42 ms
52,096 KB
testcase_10 AC 157 ms
106,060 KB
testcase_11 AC 155 ms
106,608 KB
testcase_12 AC 73 ms
89,216 KB
testcase_13 AC 78 ms
92,672 KB
testcase_14 AC 81 ms
92,672 KB
testcase_15 AC 137 ms
109,568 KB
testcase_16 AC 155 ms
105,888 KB
testcase_17 AC 104 ms
107,520 KB
testcase_18 AC 110 ms
109,880 KB
testcase_19 AC 110 ms
105,472 KB
testcase_20 AC 127 ms
108,288 KB
testcase_21 AC 120 ms
107,288 KB
testcase_22 AC 129 ms
108,672 KB
testcase_23 AC 158 ms
106,452 KB
testcase_24 AC 163 ms
105,852 KB
testcase_25 AC 163 ms
105,024 KB
testcase_26 AC 158 ms
106,624 KB
testcase_27 AC 85 ms
97,280 KB
testcase_28 AC 85 ms
97,152 KB
testcase_29 AC 82 ms
97,536 KB
testcase_30 AC 86 ms
97,280 KB
testcase_31 AC 134 ms
102,804 KB
testcase_32 AC 168 ms
105,528 KB
testcase_33 AC 119 ms
104,344 KB
testcase_34 AC 119 ms
104,360 KB
testcase_35 AC 98 ms
100,992 KB
testcase_36 AC 123 ms
102,016 KB
testcase_37 AC 120 ms
104,080 KB
testcase_38 AC 121 ms
103,596 KB
testcase_39 AC 106 ms
103,744 KB
testcase_40 AC 107 ms
104,652 KB
testcase_41 AC 156 ms
101,360 KB
testcase_42 AC 158 ms
101,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys,bisect
input=lambda:sys.stdin.readline().rstrip()
def gcd(a,b):
	m,M=min(a,b),max(a,b)
	return M if m==0 else gcd(m,M%m)
N=int(input())
A=sorted(list(map(int,input().split())))
ind=bisect.bisect_right(A,0)
d,flg=0,0
for i in range(ind,N-1):
	d=gcd(d,A[i+1]-A[i])
	flg|=A[i]==A[i-1]
if d==0:
	print('Yes')
elif flg:
	print('No')
else:
	print(['Yes','No'][(A[-1]-A[ind])//d+1-N>0])
0