結果

問題 No.1884 Sequence
ユーザー iorioniorion
提出日時 2022-03-25 21:32:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 451 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,420 KB
最終ジャッジ日時 2024-04-22 06:08:43
合計ジャッジ時間 10,138 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,880 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 32 ms
10,752 KB
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 31 ms
10,880 KB
testcase_08 AC 32 ms
10,752 KB
testcase_09 WA -
testcase_10 AC 436 ms
34,272 KB
testcase_11 AC 442 ms
34,268 KB
testcase_12 AC 75 ms
13,672 KB
testcase_13 AC 80 ms
13,800 KB
testcase_14 AC 82 ms
14,364 KB
testcase_15 AC 276 ms
23,252 KB
testcase_16 AC 468 ms
34,268 KB
testcase_17 AC 143 ms
20,560 KB
testcase_18 AC 195 ms
24,780 KB
testcase_19 AC 163 ms
21,616 KB
testcase_20 AC 219 ms
20,952 KB
testcase_21 AC 170 ms
19,544 KB
testcase_22 AC 239 ms
22,200 KB
testcase_23 AC 458 ms
32,724 KB
testcase_24 AC 450 ms
34,264 KB
testcase_25 AC 440 ms
32,848 KB
testcase_26 AC 467 ms
34,252 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 AC 87 ms
14,768 KB
testcase_30 AC 87 ms
14,776 KB
testcase_31 AC 232 ms
21,120 KB
testcase_32 WA -
testcase_33 AC 176 ms
34,292 KB
testcase_34 AC 172 ms
34,420 KB
testcase_35 AC 103 ms
15,900 KB
testcase_36 AC 162 ms
26,516 KB
testcase_37 AC 219 ms
34,296 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 365 ms
28,828 KB
testcase_42 AC 371 ms
28,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
from functools import reduce
n = int(input())
a = [*map(int, input().split())]

a.sort()

zeros = a.count(0)
s = [*filter(lambda x: x > 0, a)]
sabun = [y - x for x, y in zip(s, s[1:])]

g = reduce(gcd, sabun)

if g == 0:
    if all(x == 0 for x in sabun):
        print("Yes")
    else:
        print("No")
    exit()

for x, y in zip(s, s[1:]):
    zeros -= (y - x) // g - 1

if zeros >= 0:
    print("Yes")
else:
    print("No")
0