結果

問題 No.1884 Sequence
ユーザー iorioniorion
提出日時 2022-03-25 21:44:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 482 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,436 KB
最終ジャッジ日時 2024-04-22 06:25:31
合計ジャッジ時間 9,775 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 33 ms
10,880 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 32 ms
10,880 KB
testcase_04 AC 34 ms
10,880 KB
testcase_05 AC 32 ms
10,880 KB
testcase_06 AC 32 ms
10,880 KB
testcase_07 AC 32 ms
10,880 KB
testcase_08 AC 31 ms
10,880 KB
testcase_09 AC 31 ms
10,752 KB
testcase_10 AC 442 ms
34,288 KB
testcase_11 AC 425 ms
34,280 KB
testcase_12 AC 76 ms
13,692 KB
testcase_13 AC 82 ms
13,824 KB
testcase_14 AC 82 ms
14,272 KB
testcase_15 AC 265 ms
23,264 KB
testcase_16 AC 448 ms
34,412 KB
testcase_17 AC 150 ms
20,700 KB
testcase_18 AC 200 ms
24,668 KB
testcase_19 AC 165 ms
21,496 KB
testcase_20 AC 218 ms
20,968 KB
testcase_21 AC 173 ms
19,556 KB
testcase_22 AC 239 ms
22,092 KB
testcase_23 AC 450 ms
32,736 KB
testcase_24 AC 459 ms
34,280 KB
testcase_25 AC 437 ms
32,824 KB
testcase_26 AC 482 ms
34,264 KB
testcase_27 AC 87 ms
14,792 KB
testcase_28 AC 87 ms
14,796 KB
testcase_29 AC 88 ms
14,792 KB
testcase_30 AC 88 ms
14,792 KB
testcase_31 AC 176 ms
21,132 KB
testcase_32 AC 326 ms
33,072 KB
testcase_33 AC 172 ms
34,308 KB
testcase_34 AC 179 ms
34,308 KB
testcase_35 AC 105 ms
15,916 KB
testcase_36 AC 158 ms
26,528 KB
testcase_37 AC 160 ms
34,436 KB
testcase_38 AC 167 ms
33,912 KB
testcase_39 AC 118 ms
18,756 KB
testcase_40 AC 125 ms
19,536 KB
testcase_41 AC 365 ms
28,840 KB
testcase_42 AC 355 ms
28,928 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) <= 1:
    print("Yes")
    exit()

sabun = [y - x for x, y in zip(s, s[1:])]
g = reduce(gcd, sabun)

if g == 0 or 0 in sabun:
    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