結果

問題 No.1884 Sequence
ユーザー shinichishinichi
提出日時 2022-03-25 22:19:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 137,852 KB
最終ジャッジ日時 2024-04-22 06:59:38
合計ジャッジ時間 7,290 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 46 ms
53,504 KB
testcase_03 AC 45 ms
53,632 KB
testcase_04 AC 45 ms
53,760 KB
testcase_05 AC 45 ms
53,888 KB
testcase_06 AC 45 ms
53,632 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 94 ms
100,992 KB
testcase_28 AC 95 ms
101,248 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 125 ms
105,004 KB
testcase_34 AC 124 ms
104,616 KB
testcase_35 AC 109 ms
104,576 KB
testcase_36 AC 130 ms
100,096 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from collections import Counter

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


A.sort()
zeros = A.count(0)
nonzeros = N - zeros
k = 0
for i in range(zeros, N-1):
    a, b = A[i], A[i+1]
    k = math.gcd(k, b - a)

AA = Counter(A)
cant = False
for key, value in AA.items():
    if key != 0 and value >= 2:
        if cant:
            exit(print("No"))
        else:
            cant = True

if k != 0:
    need = (A[-1] - A[zeros]) // k + 1 - nonzeros
    print(need, zeros)
    if need <= zeros:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

0