結果

問題 No.1884 Sequence
ユーザー AEnAEn
提出日時 2022-05-12 14:19:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 189 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 120,300 KB
最終ジャッジ日時 2023-09-27 13:32:05
合計ジャッジ時間 7,302 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
71,004 KB
testcase_01 AC 61 ms
71,044 KB
testcase_02 AC 60 ms
71,120 KB
testcase_03 AC 59 ms
71,028 KB
testcase_04 AC 60 ms
70,884 KB
testcase_05 AC 60 ms
71,196 KB
testcase_06 AC 61 ms
71,264 KB
testcase_07 AC 58 ms
70,944 KB
testcase_08 AC 63 ms
71,152 KB
testcase_09 AC 61 ms
71,028 KB
testcase_10 AC 189 ms
119,516 KB
testcase_11 AC 188 ms
120,072 KB
testcase_12 AC 85 ms
97,660 KB
testcase_13 AC 86 ms
100,968 KB
testcase_14 AC 91 ms
98,208 KB
testcase_15 AC 142 ms
106,120 KB
testcase_16 AC 158 ms
119,604 KB
testcase_17 AC 107 ms
106,936 KB
testcase_18 AC 124 ms
107,216 KB
testcase_19 AC 106 ms
105,056 KB
testcase_20 AC 129 ms
107,332 KB
testcase_21 AC 118 ms
106,460 KB
testcase_22 AC 143 ms
105,056 KB
testcase_23 AC 154 ms
119,644 KB
testcase_24 AC 154 ms
119,548 KB
testcase_25 AC 156 ms
119,124 KB
testcase_26 AC 157 ms
120,300 KB
testcase_27 AC 90 ms
104,188 KB
testcase_28 AC 92 ms
104,104 KB
testcase_29 AC 95 ms
104,136 KB
testcase_30 AC 93 ms
104,260 KB
testcase_31 AC 122 ms
101,920 KB
testcase_32 AC 161 ms
119,356 KB
testcase_33 AC 116 ms
104,324 KB
testcase_34 AC 114 ms
104,368 KB
testcase_35 AC 102 ms
104,788 KB
testcase_36 AC 124 ms
100,028 KB
testcase_37 AC 131 ms
104,396 KB
testcase_38 AC 114 ms
103,152 KB
testcase_39 AC 106 ms
105,844 KB
testcase_40 AC 112 ms
106,856 KB
testcase_41 AC 157 ms
113,108 KB
testcase_42 AC 151 ms
112,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())
A = list(map(int, input().split()))
A.sort()
cnt = 0
start = 0
sa = []
bad = set()
bad_cnt = 0
for i in range(N):
    if A[i] == 0:
        cnt += 1
    else:
        if start != 0:
            if A[i]-start > 0:
                sa.append(A[i]-start)
            else:
                bad.add(A[i])
                bad_cnt += 1
        start = A[i]
    if len(sa)==1:
        gcd = sa[0]
    elif len(sa)>1:
        gcd = math.gcd(gcd, sa[-1])
res = 0
if len(bad) > 1 or (len(bad)==1 and 1+bad_cnt+cnt<N):
    print('No')
    exit()
if len(sa) == 0:
    print('Yes')
    exit()
for i in range(len(sa)):
    res += (sa[i]//gcd-1)
if cnt >= res:
    print('Yes')
else:
    print('No')
0