結果

問題 No.1884 Sequence
ユーザー lloyzlloyz
提出日時 2022-03-25 21:34:17
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 647 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,600 KB
実行使用メモリ 131,728 KB
最終ジャッジ日時 2024-04-22 06:12:37
合計ジャッジ時間 6,448 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
54,016 KB
testcase_01 AC 42 ms
54,016 KB
testcase_02 AC 42 ms
53,376 KB
testcase_03 RE -
testcase_04 AC 43 ms
53,760 KB
testcase_05 AC 42 ms
54,016 KB
testcase_06 AC 42 ms
54,272 KB
testcase_07 AC 42 ms
53,504 KB
testcase_08 AC 41 ms
53,760 KB
testcase_09 AC 42 ms
53,760 KB
testcase_10 AC 221 ms
131,208 KB
testcase_11 AC 217 ms
131,728 KB
testcase_12 AC 73 ms
92,544 KB
testcase_13 AC 75 ms
96,052 KB
testcase_14 AC 79 ms
93,952 KB
testcase_15 AC 135 ms
106,296 KB
testcase_16 AC 158 ms
119,092 KB
testcase_17 AC 97 ms
107,264 KB
testcase_18 AC 113 ms
106,436 KB
testcase_19 AC 98 ms
105,216 KB
testcase_20 AC 122 ms
106,460 KB
testcase_21 AC 111 ms
107,008 KB
testcase_22 AC 133 ms
105,152 KB
testcase_23 AC 163 ms
118,964 KB
testcase_24 AC 159 ms
119,152 KB
testcase_25 AC 159 ms
118,420 KB
testcase_26 AC 159 ms
119,276 KB
testcase_27 RE -
testcase_28 AC 81 ms
100,736 KB
testcase_29 AC 80 ms
100,480 KB
testcase_30 AC 82 ms
100,096 KB
testcase_31 AC 114 ms
101,504 KB
testcase_32 AC 160 ms
119,260 KB
testcase_33 AC 124 ms
118,256 KB
testcase_34 AC 123 ms
118,120 KB
testcase_35 AC 93 ms
104,320 KB
testcase_36 AC 126 ms
107,512 KB
testcase_37 AC 123 ms
118,020 KB
testcase_38 AC 124 ms
115,940 KB
testcase_39 AC 108 ms
107,136 KB
testcase_40 AC 109 ms
107,264 KB
testcase_41 AC 158 ms
114,300 KB
testcase_42 AC 152 ms
113,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from math import gcd

n = int(input())
A = list(map(int, input().split()))

A.sort(reverse=True)
num = 0
while A[-1] == 0:
    num += 1
    A.pop()
if len(A) == 1:
    print("Yes")
    exit()

A.reverse()
D = []
for i in range(1, len(A)):
    D.append(A[i] - A[i - 1])
counter = Counter(D)
D = list(counter.keys())

if min(D) == 0:
    for dif in D:
        num -= dif * counter[dif]
else:
    dif_gcd = D[0]
    for i in range(1, len(D)):
        dif_gcd = gcd(dif_gcd, D[i])

    for dif in D:
        cnt = dif // dif_gcd - 1
        num -= cnt * counter[dif]
if num >= 0:
    print("Yes")
else:
    print("No")
0