結果

問題 No.1884 Sequence
ユーザー 👑 KazunKazun
提出日時 2022-03-25 21:41:37
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 268 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 577 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 151,020 KB
最終ジャッジ日時 2023-08-04 08:34:53
合計ジャッジ時間 8,844 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,196 KB
testcase_01 AC 70 ms
71,096 KB
testcase_02 AC 73 ms
71,400 KB
testcase_03 AC 72 ms
71,276 KB
testcase_04 AC 73 ms
71,128 KB
testcase_05 AC 73 ms
71,292 KB
testcase_06 AC 72 ms
71,304 KB
testcase_07 AC 74 ms
71,492 KB
testcase_08 AC 74 ms
71,508 KB
testcase_09 AC 74 ms
71,284 KB
testcase_10 AC 268 ms
150,468 KB
testcase_11 AC 254 ms
151,020 KB
testcase_12 AC 105 ms
97,720 KB
testcase_13 AC 108 ms
100,540 KB
testcase_14 AC 111 ms
97,640 KB
testcase_15 AC 182 ms
120,072 KB
testcase_16 AC 220 ms
150,484 KB
testcase_17 AC 137 ms
106,744 KB
testcase_18 AC 163 ms
122,504 KB
testcase_19 AC 140 ms
104,096 KB
testcase_20 AC 157 ms
107,180 KB
testcase_21 AC 140 ms
106,056 KB
testcase_22 AC 171 ms
117,524 KB
testcase_23 AC 212 ms
150,536 KB
testcase_24 AC 220 ms
150,824 KB
testcase_25 AC 213 ms
149,752 KB
testcase_26 AC 217 ms
150,608 KB
testcase_27 AC 109 ms
104,108 KB
testcase_28 AC 112 ms
104,192 KB
testcase_29 AC 125 ms
104,520 KB
testcase_30 AC 118 ms
103,988 KB
testcase_31 AC 133 ms
101,080 KB
testcase_32 AC 178 ms
147,956 KB
testcase_33 AC 144 ms
117,640 KB
testcase_34 AC 145 ms
117,588 KB
testcase_35 AC 116 ms
104,488 KB
testcase_36 AC 147 ms
106,760 KB
testcase_37 AC 146 ms
117,504 KB
testcase_38 AC 145 ms
116,284 KB
testcase_39 AC 122 ms
106,008 KB
testcase_40 AC 122 ms
106,276 KB
testcase_41 AC 209 ms
136,044 KB
testcase_42 AC 213 ms
135,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(A):
    from math import gcd

    E=[a for a in A if a!=0]; E_set=set(E)
    M=A.count(0)

    if M==N or M==N-1:
        return 1

    if len(E)!=len(E_set):
        return len(E_set)==1

    E.sort()
    g=0
    for i in range(len(E)-1):
        g=gcd(g,E[i+1]-E[i])

    E_min=E[0]; E_max=E[-1]
    X=E_min

    for _ in range(M+1):
        while X in E_set:
            X+=g
        X+=g

    return X>E_max

N=int(input())
A=list(map(int,input().split()))
print("Yes" if solve(A) else "No")
0