結果

問題 No.1884 Sequence
ユーザー 👑 KazunKazun
提出日時 2022-03-25 21:32:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 507 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 149,488 KB
最終ジャッジ日時 2024-04-22 06:09:11
合計ジャッジ時間 6,575 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,968 KB
testcase_01 AC 40 ms
51,968 KB
testcase_02 AC 41 ms
52,096 KB
testcase_03 AC 40 ms
52,096 KB
testcase_04 AC 40 ms
51,968 KB
testcase_05 AC 39 ms
52,096 KB
testcase_06 AC 38 ms
52,480 KB
testcase_07 WA -
testcase_08 AC 38 ms
52,224 KB
testcase_09 AC 38 ms
52,352 KB
testcase_10 AC 224 ms
148,728 KB
testcase_11 AC 221 ms
149,284 KB
testcase_12 AC 70 ms
88,832 KB
testcase_13 AC 74 ms
92,416 KB
testcase_14 AC 78 ms
91,392 KB
testcase_15 AC 143 ms
107,520 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 129 ms
108,160 KB
testcase_19 AC 113 ms
109,024 KB
testcase_20 AC 131 ms
110,848 KB
testcase_21 AC 114 ms
107,520 KB
testcase_22 AC 137 ms
106,796 KB
testcase_23 AC 188 ms
149,124 KB
testcase_24 AC 186 ms
149,488 KB
testcase_25 AC 188 ms
147,960 KB
testcase_26 AC 188 ms
149,296 KB
testcase_27 AC 75 ms
95,744 KB
testcase_28 AC 75 ms
96,232 KB
testcase_29 AC 78 ms
96,256 KB
testcase_30 AC 81 ms
97,024 KB
testcase_31 AC 118 ms
104,736 KB
testcase_32 AC 189 ms
147,608 KB
testcase_33 AC 121 ms
116,168 KB
testcase_34 AC 121 ms
115,788 KB
testcase_35 AC 83 ms
100,224 KB
testcase_36 AC 117 ms
105,804 KB
testcase_37 AC 123 ms
115,780 KB
testcase_38 AC 121 ms
114,280 KB
testcase_39 AC 90 ms
105,088 KB
testcase_40 AC 90 ms
106,112 KB
testcase_41 AC 178 ms
132,652 KB
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(A):
    from math import gcd

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

    if len(E)<=2:
        return True
    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]
    E_set=set(E)

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

    X=E_min
    for _ in range(M):
        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