結果

問題 No.1884 Sequence
ユーザー shinichishinichi
提出日時 2022-03-25 22:28:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 220 ms / 2,000 ms
コード長 714 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 82,624 KB
実行使用メモリ 137,764 KB
最終ジャッジ日時 2024-04-22 07:11:23
合計ジャッジ時間 6,621 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,248 KB
testcase_01 AC 45 ms
53,376 KB
testcase_02 AC 46 ms
53,248 KB
testcase_03 AC 41 ms
53,632 KB
testcase_04 AC 41 ms
53,504 KB
testcase_05 AC 41 ms
53,888 KB
testcase_06 AC 41 ms
53,888 KB
testcase_07 AC 41 ms
54,016 KB
testcase_08 AC 42 ms
53,248 KB
testcase_09 AC 41 ms
53,248 KB
testcase_10 AC 220 ms
136,760 KB
testcase_11 AC 218 ms
137,320 KB
testcase_12 AC 73 ms
93,184 KB
testcase_13 AC 77 ms
96,896 KB
testcase_14 AC 88 ms
97,920 KB
testcase_15 AC 150 ms
113,840 KB
testcase_16 AC 180 ms
137,076 KB
testcase_17 AC 106 ms
106,112 KB
testcase_18 AC 129 ms
115,816 KB
testcase_19 AC 108 ms
104,828 KB
testcase_20 AC 134 ms
106,368 KB
testcase_21 AC 119 ms
105,984 KB
testcase_22 AC 145 ms
112,100 KB
testcase_23 AC 180 ms
136,764 KB
testcase_24 AC 180 ms
136,644 KB
testcase_25 AC 181 ms
136,380 KB
testcase_26 AC 183 ms
137,764 KB
testcase_27 AC 82 ms
100,736 KB
testcase_28 AC 83 ms
101,248 KB
testcase_29 AC 83 ms
101,632 KB
testcase_30 AC 83 ms
101,504 KB
testcase_31 AC 125 ms
101,632 KB
testcase_32 AC 186 ms
137,064 KB
testcase_33 AC 111 ms
104,720 KB
testcase_34 AC 109 ms
105,012 KB
testcase_35 AC 97 ms
104,064 KB
testcase_36 AC 117 ms
99,456 KB
testcase_37 AC 112 ms
104,716 KB
testcase_38 AC 109 ms
102,760 KB
testcase_39 AC 102 ms
105,980 KB
testcase_40 AC 103 ms
106,520 KB
testcase_41 AC 173 ms
126,472 KB
testcase_42 AC 179 ms
126,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from collections import Counter

N = int(input())
A = list(map(int, input().split()))


A.sort()
zeros = A.count(0)
nonzeros = N - zeros
k = 0
for i in range(zeros, N-1):
    a, b = A[i], A[i+1]
    k = math.gcd(k, b - a)

AA = Counter(A)
check1, check2 = False, False
for key, value in AA.items():
    if key != 0:
        if value >= 2 and check2:
            exit(print("No"))
        if value >= 2:
            check1 = True
        if value == 1 and check1:
            exit(print("No"))
        if value == 1:
            check2 = True


if k != 0:
    need = (A[-1] - A[zeros]) // k + 1 - nonzeros
    if need <= zeros:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

0