結果

問題 No.1884 Sequence
ユーザー ikomaikoma
提出日時 2022-03-25 23:15:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 180,880 KB
最終ジャッジ日時 2024-04-22 08:11:42
合計ジャッジ時間 7,208 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,968 KB
testcase_01 AC 37 ms
52,224 KB
testcase_02 AC 37 ms
51,584 KB
testcase_03 AC 36 ms
52,352 KB
testcase_04 AC 37 ms
52,096 KB
testcase_05 AC 37 ms
52,224 KB
testcase_06 AC 37 ms
51,712 KB
testcase_07 AC 38 ms
52,224 KB
testcase_08 AC 39 ms
52,608 KB
testcase_09 AC 38 ms
51,584 KB
testcase_10 AC 260 ms
180,308 KB
testcase_11 AC 253 ms
180,880 KB
testcase_12 AC 67 ms
88,656 KB
testcase_13 AC 70 ms
92,032 KB
testcase_14 AC 74 ms
91,904 KB
testcase_15 AC 152 ms
113,160 KB
testcase_16 AC 212 ms
180,508 KB
testcase_17 AC 110 ms
122,624 KB
testcase_18 AC 129 ms
117,840 KB
testcase_19 AC 115 ms
127,872 KB
testcase_20 AC 139 ms
116,352 KB
testcase_21 AC 122 ms
118,664 KB
testcase_22 AC 145 ms
117,504 KB
testcase_23 AC 211 ms
180,536 KB
testcase_24 AC 213 ms
180,256 KB
testcase_25 AC 215 ms
179,472 KB
testcase_26 AC 227 ms
180,784 KB
testcase_27 AC 73 ms
95,744 KB
testcase_28 AC 73 ms
94,976 KB
testcase_29 AC 76 ms
95,616 KB
testcase_30 AC 74 ms
96,256 KB
testcase_31 AC 131 ms
124,544 KB
testcase_32 AC 220 ms
179,428 KB
testcase_33 AC 100 ms
101,980 KB
testcase_34 AC 101 ms
102,188 KB
testcase_35 AC 76 ms
96,000 KB
testcase_36 AC 97 ms
99,712 KB
testcase_37 AC 114 ms
116,444 KB
testcase_38 AC 113 ms
114,224 KB
testcase_39 AC 94 ms
104,448 KB
testcase_40 AC 103 ms
105,472 KB
testcase_41 AC 199 ms
156,240 KB
testcase_42 AC 196 ms
155,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
import sys
input = sys.stdin.readline

def solve():
    N=int(input())
    A=list(map(int,input().split()))
    if len(set(A)-set([0]))<=1:return True
    A.sort()
    cnt0=0
    d_lst = []
    for i in range(N-1):
        if A[i]==0:
            cnt0+=1
            continue
        d = A[i+1]-A[i]
        d_lst.append(d)
    d_min = min(d_lst)
    if d_min==0:
        return False
    g = d_lst[0]
    for i in range(1,len(d_lst)):g=gcd(g,d_lst[i])
    for d in d_lst:
        cnt0 -= d//g-1
    return cnt0>=0

print("Yes" if solve() else "No")
0