結果

問題 No.1884 Sequence
ユーザー AEnAEn
提出日時 2022-05-12 14:18:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 1,938 ms
コンパイル使用メモリ 86,468 KB
実行使用メモリ 120,388 KB
最終ジャッジ日時 2023-09-27 13:29:31
合計ジャッジ時間 9,250 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,052 KB
testcase_01 AC 63 ms
71,448 KB
testcase_02 WA -
testcase_03 AC 61 ms
71,116 KB
testcase_04 AC 61 ms
71,088 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 63 ms
71,084 KB
testcase_08 AC 62 ms
71,456 KB
testcase_09 AC 62 ms
71,364 KB
testcase_10 AC 200 ms
119,632 KB
testcase_11 AC 202 ms
120,316 KB
testcase_12 AC 90 ms
98,012 KB
testcase_13 AC 89 ms
100,804 KB
testcase_14 AC 94 ms
98,124 KB
testcase_15 AC 147 ms
106,140 KB
testcase_16 AC 160 ms
119,776 KB
testcase_17 AC 107 ms
106,852 KB
testcase_18 AC 125 ms
107,364 KB
testcase_19 AC 109 ms
105,252 KB
testcase_20 AC 128 ms
107,176 KB
testcase_21 AC 120 ms
106,808 KB
testcase_22 AC 144 ms
105,048 KB
testcase_23 AC 164 ms
119,872 KB
testcase_24 AC 176 ms
119,620 KB
testcase_25 AC 162 ms
119,268 KB
testcase_26 AC 161 ms
120,388 KB
testcase_27 AC 95 ms
104,352 KB
testcase_28 AC 97 ms
104,452 KB
testcase_29 AC 95 ms
104,356 KB
testcase_30 AC 95 ms
104,552 KB
testcase_31 AC 124 ms
102,200 KB
testcase_32 AC 165 ms
119,612 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 127 ms
104,352 KB
testcase_38 AC 114 ms
103,148 KB
testcase_39 AC 112 ms
106,124 KB
testcase_40 AC 112 ms
106,964 KB
testcase_41 AC 157 ms
113,568 KB
testcase_42 AC 159 ms
112,892 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 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