結果

問題 No.1884 Sequence
ユーザー tassei903tassei903
提出日時 2022-03-25 22:52:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 199 ms / 2,000 ms
コード長 812 bytes
コンパイル時間 940 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 151,252 KB
最終ジャッジ日時 2023-08-04 09:56:58
合計ジャッジ時間 7,548 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,456 KB
testcase_01 AC 64 ms
71,308 KB
testcase_02 AC 61 ms
71,312 KB
testcase_03 AC 62 ms
71,440 KB
testcase_04 AC 62 ms
71,148 KB
testcase_05 AC 64 ms
71,396 KB
testcase_06 AC 62 ms
71,332 KB
testcase_07 AC 63 ms
71,460 KB
testcase_08 AC 60 ms
71,388 KB
testcase_09 AC 62 ms
71,236 KB
testcase_10 AC 197 ms
121,408 KB
testcase_11 AC 199 ms
121,452 KB
testcase_12 AC 88 ms
98,076 KB
testcase_13 AC 90 ms
100,700 KB
testcase_14 AC 91 ms
97,980 KB
testcase_15 AC 135 ms
106,612 KB
testcase_16 AC 168 ms
121,388 KB
testcase_17 AC 108 ms
107,216 KB
testcase_18 AC 124 ms
107,432 KB
testcase_19 AC 113 ms
104,620 KB
testcase_20 AC 130 ms
107,572 KB
testcase_21 AC 116 ms
106,480 KB
testcase_22 AC 138 ms
106,124 KB
testcase_23 AC 163 ms
121,284 KB
testcase_24 AC 168 ms
121,616 KB
testcase_25 AC 168 ms
120,604 KB
testcase_26 AC 170 ms
121,396 KB
testcase_27 AC 111 ms
104,180 KB
testcase_28 AC 99 ms
104,480 KB
testcase_29 AC 98 ms
104,592 KB
testcase_30 AC 98 ms
104,548 KB
testcase_31 AC 131 ms
101,684 KB
testcase_32 AC 196 ms
151,252 KB
testcase_33 AC 164 ms
120,500 KB
testcase_34 AC 134 ms
120,652 KB
testcase_35 AC 101 ms
105,156 KB
testcase_36 AC 141 ms
108,696 KB
testcase_37 AC 134 ms
120,740 KB
testcase_38 AC 132 ms
118,628 KB
testcase_39 AC 111 ms
108,492 KB
testcase_40 AC 114 ms
106,756 KB
testcase_41 AC 157 ms
115,740 KB
testcase_42 AC 163 ms
115,484 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