結果

問題 No.1884 Sequence
ユーザー pluto77pluto77
提出日時 2022-05-29 16:29:29
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 328 ms / 2,000 ms
コード長 387 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 11,908 KB
実行使用メモリ 36,836 KB
最終ジャッジ日時 2023-10-20 23:56:14
合計ジャッジ時間 10,416 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,184 KB
testcase_01 AC 28 ms
10,184 KB
testcase_02 AC 27 ms
10,184 KB
testcase_03 AC 30 ms
10,184 KB
testcase_04 AC 30 ms
10,184 KB
testcase_05 AC 28 ms
10,184 KB
testcase_06 AC 28 ms
10,184 KB
testcase_07 AC 28 ms
10,184 KB
testcase_08 AC 28 ms
10,184 KB
testcase_09 AC 29 ms
10,184 KB
testcase_10 AC 324 ms
36,836 KB
testcase_11 AC 323 ms
36,832 KB
testcase_12 AC 74 ms
12,868 KB
testcase_13 AC 79 ms
13,020 KB
testcase_14 AC 75 ms
13,108 KB
testcase_15 AC 202 ms
23,664 KB
testcase_16 AC 316 ms
36,828 KB
testcase_17 AC 126 ms
21,380 KB
testcase_18 AC 165 ms
25,528 KB
testcase_19 AC 140 ms
22,900 KB
testcase_20 AC 172 ms
20,160 KB
testcase_21 AC 141 ms
18,744 KB
testcase_22 AC 192 ms
23,492 KB
testcase_23 AC 321 ms
36,044 KB
testcase_24 AC 322 ms
36,828 KB
testcase_25 AC 325 ms
36,044 KB
testcase_26 AC 328 ms
36,812 KB
testcase_27 AC 93 ms
14,048 KB
testcase_28 AC 87 ms
14,048 KB
testcase_29 AC 87 ms
14,048 KB
testcase_30 AC 88 ms
14,048 KB
testcase_31 AC 150 ms
23,580 KB
testcase_32 AC 239 ms
36,640 KB
testcase_33 AC 130 ms
33,636 KB
testcase_34 AC 130 ms
33,636 KB
testcase_35 AC 91 ms
15,792 KB
testcase_36 AC 117 ms
25,776 KB
testcase_37 AC 142 ms
33,636 KB
testcase_38 AC 135 ms
33,244 KB
testcase_39 AC 102 ms
19,064 KB
testcase_40 AC 103 ms
18,936 KB
testcase_41 AC 271 ms
28,152 KB
testcase_42 AC 267 ms
28,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1884
from math import gcd
N=int(input())
A=list(map(int,input().split()))
ZERO=0
B=[]
for a in A:
 if a==0:
  ZERO+=1
 else:
  B.append(a)
B.sort()
if len(set(B))<=1:
 print('Yes')
 exit()
if len(set(B))!=len(B):
 print('No')
 exit()
GCD=0
for i in range(1,len(B)):
 GCD=gcd(GCD,B[i]-B[i-1])
MIN=B[0]
MAX=B[-1]
k=(MAX-MIN)//GCD+1
if k-len(B)<=ZERO:
 print('Yes')
else:
 print('No')
0