結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,624 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 28 ms
10,624 KB
testcase_03 AC 26 ms
10,752 KB
testcase_04 AC 26 ms
10,624 KB
testcase_05 AC 26 ms
10,880 KB
testcase_06 AC 27 ms
10,880 KB
testcase_07 AC 26 ms
10,624 KB
testcase_08 AC 26 ms
10,624 KB
testcase_09 WA -
testcase_10 AC 334 ms
34,296 KB
testcase_11 AC 326 ms
34,288 KB
testcase_12 AC 65 ms
13,440 KB
testcase_13 AC 71 ms
13,848 KB
testcase_14 AC 72 ms
14,148 KB
testcase_15 AC 221 ms
23,268 KB
testcase_16 AC 338 ms
34,284 KB
testcase_17 AC 126 ms
20,428 KB
testcase_18 AC 170 ms
24,800 KB
testcase_19 AC 143 ms
21,500 KB
testcase_20 AC 195 ms
20,972 KB
testcase_21 AC 151 ms
19,304 KB
testcase_22 AC 199 ms
22,096 KB
testcase_23 AC 343 ms
32,872 KB
testcase_24 AC 351 ms
34,160 KB
testcase_25 AC 321 ms
32,744 KB
testcase_26 AC 352 ms
34,268 KB
testcase_27 AC 79 ms
13,936 KB
testcase_28 AC 82 ms
14,064 KB
testcase_29 AC 78 ms
13,932 KB
testcase_30 AC 80 ms
14,068 KB
testcase_31 AC 187 ms
21,144 KB
testcase_32 WA -
testcase_33 AC 157 ms
32,648 KB
testcase_34 AC 153 ms
32,616 KB
testcase_35 AC 95 ms
15,788 KB
testcase_36 AC 142 ms
26,528 KB
testcase_37 AC 195 ms
32,620 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 280 ms
28,844 KB
testcase_42 AC 278 ms
28,724 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:
    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