結果

問題 No.1884 Sequence
ユーザー lloyzlloyz
提出日時 2022-03-25 21:35:02
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 647 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 131,640 KB
最終ジャッジ日時 2024-04-22 06:14:16
合計ジャッジ時間 6,957 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,632 KB
testcase_01 AC 41 ms
53,632 KB
testcase_02 AC 39 ms
53,376 KB
testcase_03 RE -
testcase_04 AC 40 ms
53,632 KB
testcase_05 AC 43 ms
53,376 KB
testcase_06 AC 42 ms
53,376 KB
testcase_07 AC 42 ms
53,632 KB
testcase_08 AC 43 ms
53,376 KB
testcase_09 AC 41 ms
53,504 KB
testcase_10 AC 199 ms
131,380 KB
testcase_11 AC 200 ms
131,640 KB
testcase_12 AC 75 ms
92,160 KB
testcase_13 AC 76 ms
95,872 KB
testcase_14 AC 84 ms
93,696 KB
testcase_15 AC 135 ms
106,292 KB
testcase_16 AC 155 ms
119,104 KB
testcase_17 AC 100 ms
106,880 KB
testcase_18 AC 115 ms
106,316 KB
testcase_19 AC 99 ms
105,728 KB
testcase_20 AC 121 ms
106,368 KB
testcase_21 AC 109 ms
107,008 KB
testcase_22 AC 129 ms
105,068 KB
testcase_23 AC 156 ms
119,100 KB
testcase_24 AC 152 ms
118,728 KB
testcase_25 AC 169 ms
118,416 KB
testcase_26 AC 157 ms
119,276 KB
testcase_27 RE -
testcase_28 AC 84 ms
100,096 KB
testcase_29 AC 86 ms
100,096 KB
testcase_30 AC 84 ms
99,840 KB
testcase_31 AC 122 ms
101,376 KB
testcase_32 AC 155 ms
118,760 KB
testcase_33 AC 121 ms
118,160 KB
testcase_34 AC 125 ms
118,164 KB
testcase_35 AC 97 ms
104,064 KB
testcase_36 AC 124 ms
107,264 KB
testcase_37 AC 131 ms
118,408 KB
testcase_38 AC 129 ms
115,992 KB
testcase_39 AC 109 ms
107,008 KB
testcase_40 AC 106 ms
107,264 KB
testcase_41 AC 148 ms
114,344 KB
testcase_42 AC 149 ms
113,580 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