結果

問題 No.1884 Sequence
ユーザー titiatitia
提出日時 2022-03-25 21:31:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 411 ms / 2,000 ms
コード長 427 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 37,576 KB
最終ジャッジ日時 2024-04-22 06:08:22
合計ジャッジ時間 9,456 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 32 ms
10,880 KB
testcase_02 AC 32 ms
10,880 KB
testcase_03 AC 31 ms
10,880 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 31 ms
10,880 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 30 ms
10,880 KB
testcase_09 AC 30 ms
10,880 KB
testcase_10 AC 394 ms
37,576 KB
testcase_11 AC 404 ms
36,680 KB
testcase_12 AC 86 ms
13,676 KB
testcase_13 AC 90 ms
13,808 KB
testcase_14 AC 86 ms
14,396 KB
testcase_15 AC 237 ms
25,464 KB
testcase_16 AC 395 ms
37,548 KB
testcase_17 AC 146 ms
20,540 KB
testcase_18 AC 190 ms
26,308 KB
testcase_19 AC 159 ms
23,748 KB
testcase_20 AC 200 ms
21,084 KB
testcase_21 AC 161 ms
19,544 KB
testcase_22 AC 223 ms
24,276 KB
testcase_23 AC 411 ms
36,576 KB
testcase_24 AC 405 ms
37,572 KB
testcase_25 AC 402 ms
36,664 KB
testcase_26 AC 407 ms
36,816 KB
testcase_27 AC 98 ms
14,048 KB
testcase_28 AC 99 ms
14,048 KB
testcase_29 AC 101 ms
14,180 KB
testcase_30 AC 100 ms
14,048 KB
testcase_31 AC 166 ms
24,400 KB
testcase_32 AC 290 ms
37,268 KB
testcase_33 AC 147 ms
32,856 KB
testcase_34 AC 147 ms
32,728 KB
testcase_35 AC 102 ms
15,904 KB
testcase_36 AC 133 ms
26,656 KB
testcase_37 AC 154 ms
32,852 KB
testcase_38 AC 149 ms
32,728 KB
testcase_39 AC 114 ms
18,624 KB
testcase_40 AC 116 ms
19,524 KB
testcase_41 AC 323 ms
28,840 KB
testcase_42 AC 322 ms
28,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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