結果

問題 No.1884 Sequence
ユーザー 👑 KazunKazun
提出日時 2022-03-25 21:41:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 82,544 KB
実行使用メモリ 149,124 KB
最終ジャッジ日時 2024-04-22 06:23:15
合計ジャッジ時間 6,527 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,096 KB
testcase_01 AC 39 ms
52,096 KB
testcase_02 AC 38 ms
52,096 KB
testcase_03 AC 38 ms
52,096 KB
testcase_04 AC 37 ms
51,584 KB
testcase_05 AC 37 ms
52,352 KB
testcase_06 AC 38 ms
52,224 KB
testcase_07 AC 38 ms
52,096 KB
testcase_08 AC 37 ms
52,480 KB
testcase_09 AC 38 ms
52,480 KB
testcase_10 AC 219 ms
148,728 KB
testcase_11 AC 220 ms
148,736 KB
testcase_12 AC 69 ms
88,832 KB
testcase_13 AC 72 ms
92,160 KB
testcase_14 AC 76 ms
91,520 KB
testcase_15 AC 143 ms
107,136 KB
testcase_16 AC 189 ms
149,124 KB
testcase_17 AC 105 ms
108,928 KB
testcase_18 AC 124 ms
107,648 KB
testcase_19 AC 110 ms
108,288 KB
testcase_20 AC 127 ms
111,104 KB
testcase_21 AC 109 ms
108,416 KB
testcase_22 AC 133 ms
106,624 KB
testcase_23 AC 191 ms
149,120 KB
testcase_24 AC 194 ms
148,872 KB
testcase_25 AC 184 ms
148,108 KB
testcase_26 AC 188 ms
148,788 KB
testcase_27 AC 73 ms
95,744 KB
testcase_28 AC 74 ms
95,744 KB
testcase_29 AC 89 ms
103,680 KB
testcase_30 AC 77 ms
96,640 KB
testcase_31 AC 99 ms
104,888 KB
testcase_32 AC 150 ms
146,388 KB
testcase_33 AC 116 ms
115,664 KB
testcase_34 AC 114 ms
116,220 KB
testcase_35 AC 78 ms
99,456 KB
testcase_36 AC 111 ms
106,196 KB
testcase_37 AC 115 ms
115,656 KB
testcase_38 AC 114 ms
114,144 KB
testcase_39 AC 84 ms
104,064 KB
testcase_40 AC 86 ms
105,216 KB
testcase_41 AC 174 ms
133,032 KB
testcase_42 AC 181 ms
132,660 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