結果

問題 No.1884 Sequence
ユーザー tktk_snsntktk_snsn
提出日時 2022-03-27 13:48:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 332 ms / 2,000 ms
コード長 581 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 42,464 KB
最終ジャッジ日時 2024-04-24 01:47:47
合計ジャッジ時間 8,425 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,880 KB
testcase_01 AC 28 ms
10,880 KB
testcase_02 AC 28 ms
10,880 KB
testcase_03 AC 28 ms
10,752 KB
testcase_04 AC 27 ms
11,008 KB
testcase_05 AC 27 ms
10,880 KB
testcase_06 AC 26 ms
10,880 KB
testcase_07 AC 27 ms
10,880 KB
testcase_08 AC 26 ms
10,752 KB
testcase_09 AC 27 ms
10,880 KB
testcase_10 AC 290 ms
42,436 KB
testcase_11 AC 295 ms
41,448 KB
testcase_12 AC 66 ms
13,564 KB
testcase_13 AC 68 ms
13,940 KB
testcase_14 AC 66 ms
14,404 KB
testcase_15 AC 193 ms
26,436 KB
testcase_16 AC 306 ms
42,424 KB
testcase_17 AC 121 ms
20,548 KB
testcase_18 AC 162 ms
27,860 KB
testcase_19 AC 142 ms
24,968 KB
testcase_20 AC 161 ms
20,960 KB
testcase_21 AC 128 ms
19,428 KB
testcase_22 AC 181 ms
25,564 KB
testcase_23 AC 332 ms
41,456 KB
testcase_24 AC 318 ms
42,464 KB
testcase_25 AC 294 ms
41,508 KB
testcase_26 AC 317 ms
41,572 KB
testcase_27 AC 76 ms
14,056 KB
testcase_28 AC 75 ms
14,056 KB
testcase_29 AC 72 ms
14,188 KB
testcase_30 AC 71 ms
14,052 KB
testcase_31 AC 103 ms
24,416 KB
testcase_32 AC 144 ms
37,140 KB
testcase_33 AC 113 ms
32,860 KB
testcase_34 AC 116 ms
32,732 KB
testcase_35 AC 79 ms
16,040 KB
testcase_36 AC 112 ms
26,536 KB
testcase_37 AC 122 ms
32,864 KB
testcase_38 AC 117 ms
32,868 KB
testcase_39 AC 86 ms
18,632 KB
testcase_40 AC 88 ms
19,656 KB
testcase_41 AC 266 ms
29,932 KB
testcase_42 AC 274 ms
30,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd


def main():
    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)

    if len(set(B)) == 1:
        return True
    if len(set(B)) != len(B):
        return False

    B.sort()
    C = []
    for i in range(1, len(B)):
        C.append(B[i] - B[i-1])

    g = 0
    for c in C:
        g = gcd(g, c)

    cnt = 0
    for c in C:
        cnt += (c - 1) // g
    return zero >= cnt


if main():
    print("Yes")
else:
    print("No")
0