結果

問題 No.1884 Sequence
ユーザー AEn
提出日時 2022-05-12 14:12:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 530 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 82,728 KB
実行使用メモリ 118,576 KB
最終ジャッジ日時 2024-07-20 07:27:06
合計ジャッジ時間 7,879 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 36 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

N = int(input())
A = list(map(int, input().split()))
A.sort()
cnt = 0
start = 0
sa = []
for i in range(N):
    if A[i] == 0:
        cnt += 1
    else:
        if start != 0:
            if A[i]-start > 0:
                sa.append(A[i]-start)
        start = A[i]
    if len(sa)==1:
        gcd = sa[0]
    elif len(sa)>1:
        gcd = math.gcd(gcd, sa[-1])
res = 0
if len(sa) == 0:
    print('Yes')
    exit()
for i in range(len(sa)):
    res += (sa[i]//gcd-1)
if cnt >= res:
    print('Yes')
else:
    print('No')
0