結果

問題 No.1884 Sequence
ユーザー tassei903tassei903
提出日時 2022-03-25 22:52:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 812 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 148,960 KB
最終ジャッジ日時 2024-04-22 07:40:24
合計ジャッジ時間 6,554 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,608 KB
testcase_01 AC 40 ms
52,352 KB
testcase_02 AC 39 ms
52,480 KB
testcase_03 AC 40 ms
52,224 KB
testcase_04 AC 39 ms
51,840 KB
testcase_05 AC 40 ms
51,840 KB
testcase_06 AC 42 ms
51,712 KB
testcase_07 AC 40 ms
51,712 KB
testcase_08 AC 40 ms
52,352 KB
testcase_09 AC 40 ms
52,352 KB
testcase_10 AC 195 ms
119,488 KB
testcase_11 AC 193 ms
119,872 KB
testcase_12 AC 70 ms
88,832 KB
testcase_13 AC 73 ms
92,416 KB
testcase_14 AC 75 ms
91,776 KB
testcase_15 AC 124 ms
107,904 KB
testcase_16 AC 163 ms
119,712 KB
testcase_17 AC 97 ms
109,952 KB
testcase_18 AC 105 ms
107,392 KB
testcase_19 AC 98 ms
109,824 KB
testcase_20 AC 115 ms
106,516 KB
testcase_21 AC 105 ms
108,544 KB
testcase_22 AC 119 ms
107,136 KB
testcase_23 AC 164 ms
119,952 KB
testcase_24 AC 164 ms
120,268 KB
testcase_25 AC 163 ms
118,916 KB
testcase_26 AC 164 ms
120,012 KB
testcase_27 AC 76 ms
96,768 KB
testcase_28 AC 78 ms
97,536 KB
testcase_29 AC 77 ms
97,792 KB
testcase_30 AC 79 ms
97,408 KB
testcase_31 AC 119 ms
107,136 KB
testcase_32 AC 189 ms
148,960 KB
testcase_33 AC 120 ms
117,596 KB
testcase_34 AC 121 ms
117,328 KB
testcase_35 AC 81 ms
101,248 KB
testcase_36 AC 117 ms
107,428 KB
testcase_37 AC 123 ms
118,200 KB
testcase_38 AC 123 ms
115,872 KB
testcase_39 AC 90 ms
105,600 KB
testcase_40 AC 91 ms
107,008 KB
testcase_41 AC 150 ms
111,860 KB
testcase_42 AC 149 ms
111,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

from math import gcd
n = ni()
c = 0
a = na()
b = []
for i in a:
    if i == 0:
        c += 1
    else:
        b.append(i)
b = sorted(b)
m = len(b)
if m<=2:
    Yes()
    exit()

z = 0
f = 1
for i in range(m-1):
    z = gcd(z, b[i+1]-b[i])
    if b[i+1]==b[i]:
        f = 0

if f^1:
    if len(set(b))==1:
        Yes()
    else:
        No()
    exit()

for i in range(m-1):
    c -= (b[i+1]-b[i])//z - 1
    #print(c)
if c >= 0:
    Yes()
else:
    No()
0