結果

問題 No.1884 Sequence
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2022-03-25 21:30:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 708 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 118,664 KB
最終ジャッジ日時 2024-04-22 06:06:52
合計ジャッジ時間 6,242 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,712 KB
testcase_01 AC 37 ms
51,840 KB
testcase_02 AC 36 ms
52,224 KB
testcase_03 AC 38 ms
51,840 KB
testcase_04 AC 37 ms
51,840 KB
testcase_05 AC 38 ms
52,096 KB
testcase_06 AC 36 ms
52,224 KB
testcase_07 AC 35 ms
52,224 KB
testcase_08 AC 44 ms
52,096 KB
testcase_09 AC 37 ms
51,840 KB
testcase_10 AC 179 ms
118,088 KB
testcase_11 AC 177 ms
118,092 KB
testcase_12 AC 74 ms
89,856 KB
testcase_13 AC 77 ms
93,312 KB
testcase_14 AC 84 ms
92,800 KB
testcase_15 AC 132 ms
108,672 KB
testcase_16 AC 155 ms
118,480 KB
testcase_17 AC 105 ms
106,368 KB
testcase_18 AC 110 ms
108,416 KB
testcase_19 AC 101 ms
104,576 KB
testcase_20 AC 124 ms
107,136 KB
testcase_21 AC 113 ms
105,984 KB
testcase_22 AC 129 ms
107,392 KB
testcase_23 AC 164 ms
118,100 KB
testcase_24 AC 155 ms
117,980 KB
testcase_25 AC 151 ms
117,320 KB
testcase_26 AC 156 ms
118,664 KB
testcase_27 AC 80 ms
97,280 KB
testcase_28 AC 78 ms
96,768 KB
testcase_29 AC 78 ms
97,152 KB
testcase_30 AC 81 ms
97,920 KB
testcase_31 AC 115 ms
101,504 KB
testcase_32 AC 160 ms
117,408 KB
testcase_33 AC 123 ms
116,644 KB
testcase_34 AC 120 ms
116,508 KB
testcase_35 AC 96 ms
102,400 KB
testcase_36 AC 125 ms
107,320 KB
testcase_37 AC 123 ms
116,128 KB
testcase_38 AC 129 ms
114,540 KB
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 153 ms
110,392 KB
testcase_42 AC 157 ms
110,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from sys import stdin
import math

N = int(input())

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

d = None
z = 0
B = []

for i in range(N-1):

    if A[i] != 0:
        diff = A[i+1] - A[i]
        if d == None:
            d = diff
        else:
            d = math.gcd(d,diff)

    else:
        z += 1

for i in range(N):
    if A[i] != 0:
        B.append(A[i])

if len(B) == 0:
    print ("Yes")
    sys.exit()

if d == 0:
    if max(B) == min(B):
        print ("Yes")
    else:
        print ("No")
    sys.exit()

ind = 0
for i in range(B[0],B[-1]+1,d):

    if B[ind] == i:
        ind += 1
    else:
        z -= 1

    if z < 0:
        print ("No")
        sys.exit()

print ("Yes")
0