結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 35 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 30 ms
10,880 KB
testcase_04 RE -
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 31 ms
10,880 KB
testcase_09 WA -
testcase_10 AC 409 ms
34,420 KB
testcase_11 AC 414 ms
34,288 KB
testcase_12 AC 75 ms
13,568 KB
testcase_13 AC 79 ms
13,952 KB
testcase_14 AC 80 ms
14,272 KB
testcase_15 AC 257 ms
23,268 KB
testcase_16 AC 427 ms
34,280 KB
testcase_17 AC 141 ms
20,552 KB
testcase_18 AC 191 ms
24,676 KB
testcase_19 AC 158 ms
21,628 KB
testcase_20 AC 210 ms
21,100 KB
testcase_21 AC 165 ms
19,556 KB
testcase_22 AC 230 ms
22,092 KB
testcase_23 AC 440 ms
32,744 KB
testcase_24 AC 437 ms
34,284 KB
testcase_25 AC 401 ms
32,740 KB
testcase_26 AC 430 ms
34,268 KB
testcase_27 AC 88 ms
14,188 KB
testcase_28 RE -
testcase_29 AC 87 ms
14,064 KB
testcase_30 AC 86 ms
14,188 KB
testcase_31 AC 219 ms
21,264 KB
testcase_32 WA -
testcase_33 AC 172 ms
32,744 KB
testcase_34 AC 174 ms
32,744 KB
testcase_35 AC 102 ms
15,920 KB
testcase_36 AC 155 ms
26,532 KB
testcase_37 AC 218 ms
32,744 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 348 ms
28,848 KB
testcase_42 AC 354 ms
28,848 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)]

if len(s) == 0:
    print("Yes")
    exit()

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