結果

問題 No.1884 Sequence
ユーザー kept1994kept1994
提出日時 2022-04-23 23:54:12
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 165,040 KB
最終ジャッジ日時 2023-09-07 15:03:01
合計ジャッジ時間 11,636 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,460 KB
testcase_01 AC 72 ms
71,604 KB
testcase_02 AC 72 ms
71,452 KB
testcase_03 AC 71 ms
71,460 KB
testcase_04 AC 70 ms
71,512 KB
testcase_05 AC 68 ms
71,336 KB
testcase_06 AC 71 ms
71,148 KB
testcase_07 AC 70 ms
71,836 KB
testcase_08 AC 71 ms
71,448 KB
testcase_09 WA -
testcase_10 AC 261 ms
164,876 KB
testcase_11 AC 261 ms
164,996 KB
testcase_12 AC 99 ms
97,584 KB
testcase_13 AC 102 ms
100,708 KB
testcase_14 AC 103 ms
98,132 KB
testcase_15 AC 174 ms
126,676 KB
testcase_16 AC 220 ms
164,528 KB
testcase_17 AC 130 ms
106,636 KB
testcase_18 AC 159 ms
130,084 KB
testcase_19 AC 135 ms
104,328 KB
testcase_20 AC 154 ms
107,352 KB
testcase_21 AC 137 ms
106,388 KB
testcase_22 AC 169 ms
123,416 KB
testcase_23 AC 216 ms
164,684 KB
testcase_24 AC 217 ms
164,984 KB
testcase_25 AC 220 ms
164,440 KB
testcase_26 AC 221 ms
165,040 KB
testcase_27 AC 104 ms
104,088 KB
testcase_28 AC 105 ms
104,056 KB
testcase_29 AC 105 ms
103,936 KB
testcase_30 AC 106 ms
104,192 KB
testcase_31 AC 153 ms
101,980 KB
testcase_32 WA -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 158 ms
132,060 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 199 ms
146,764 KB
testcase_42 AC 199 ms
146,472 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
    if set(aa) == set([1]):
        g = 1
    else:
        for i in range(len(aa) - 1):
            diff.append(aa[i + 1] - aa[i])
            g = math.gcd(g, aa[i + 1] - aa[i])
    ans = 0
    for d in diff:
        ans += d // g - 1
    # print(ans)
    if ans <= zero:
        print("Yes")
    else:
        print("No")

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