結果

問題 No.1884 Sequence
ユーザー kept1994kept1994
提出日時 2022-04-24 00:06:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 676 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 87,044 KB
実行使用メモリ 133,764 KB
最終ジャッジ日時 2023-09-07 15:14:02
合計ジャッジ時間 8,035 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,164 KB
testcase_01 AC 70 ms
71,592 KB
testcase_02 AC 67 ms
71,348 KB
testcase_03 AC 69 ms
71,396 KB
testcase_04 AC 70 ms
71,604 KB
testcase_05 AC 71 ms
71,592 KB
testcase_06 AC 69 ms
71,500 KB
testcase_07 AC 70 ms
71,348 KB
testcase_08 AC 71 ms
71,196 KB
testcase_09 AC 71 ms
71,336 KB
testcase_10 AC 228 ms
133,424 KB
testcase_11 AC 224 ms
133,740 KB
testcase_12 AC 96 ms
97,860 KB
testcase_13 AC 98 ms
100,564 KB
testcase_14 AC 99 ms
98,264 KB
testcase_15 AC 158 ms
112,280 KB
testcase_16 AC 192 ms
133,488 KB
testcase_17 AC 118 ms
106,748 KB
testcase_18 AC 139 ms
113,712 KB
testcase_19 AC 123 ms
104,548 KB
testcase_20 AC 138 ms
107,300 KB
testcase_21 AC 126 ms
106,380 KB
testcase_22 AC 154 ms
110,552 KB
testcase_23 AC 186 ms
133,764 KB
testcase_24 AC 186 ms
133,500 KB
testcase_25 AC 187 ms
133,200 KB
testcase_26 AC 190 ms
133,676 KB
testcase_27 AC 100 ms
104,148 KB
testcase_28 AC 102 ms
103,952 KB
testcase_29 AC 101 ms
104,004 KB
testcase_30 AC 102 ms
104,072 KB
testcase_31 AC 130 ms
101,600 KB
testcase_32 AC 181 ms
132,240 KB
testcase_33 AC 147 ms
131,852 KB
testcase_34 AC 146 ms
131,492 KB
testcase_35 AC 111 ms
105,644 KB
testcase_36 AC 141 ms
115,888 KB
testcase_37 AC 149 ms
131,844 KB
testcase_38 AC 147 ms
130,988 KB
testcase_39 AC 116 ms
106,112 KB
testcase_40 AC 116 ms
106,540 KB
testcase_41 AC 174 ms
123,976 KB
testcase_42 AC 173 ms
123,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys
import math

def main():
    N = int(input())
    A = list(map(int, input().split()))
    aa = []
    zero = 0
    for i in A:
        if i != 0:
            aa.append(i)
        else:
            zero += 1
    aa.sort()
    diff = []
    g = 0
    for i in range(len(aa) - 1):
        diff.append(aa[i + 1] - aa[i])
        g = math.gcd(g, aa[i + 1] - aa[i])

    if 0 in diff and g != 0:
        print("No")
        return
    if g == 0:
        print("Yes")
        return
    ans = 0
    for d in diff:
        ans += d // g - 1
    if ans <= zero:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()
0