結果

問題 No.1884 Sequence
ユーザー 👑 H20H20
提出日時 2022-03-25 21:44:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 219 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 182,216 KB
最終ジャッジ日時 2024-04-22 06:25:40
合計ジャッジ時間 8,545 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
53,760 KB
testcase_01 AC 45 ms
53,504 KB
testcase_02 AC 45 ms
53,504 KB
testcase_03 AC 46 ms
53,888 KB
testcase_04 AC 45 ms
53,248 KB
testcase_05 AC 45 ms
53,376 KB
testcase_06 AC 46 ms
53,504 KB
testcase_07 AC 46 ms
53,760 KB
testcase_08 AC 46 ms
53,376 KB
testcase_09 AC 45 ms
53,760 KB
testcase_10 AC 292 ms
181,940 KB
testcase_11 AC 289 ms
182,200 KB
testcase_12 AC 98 ms
97,792 KB
testcase_13 AC 102 ms
100,864 KB
testcase_14 AC 108 ms
98,176 KB
testcase_15 AC 210 ms
134,188 KB
testcase_16 AC 278 ms
182,216 KB
testcase_17 AC 147 ms
105,728 KB
testcase_18 AC 177 ms
138,708 KB
testcase_19 AC 167 ms
108,780 KB
testcase_20 AC 177 ms
106,624 KB
testcase_21 AC 153 ms
105,856 KB
testcase_22 AC 190 ms
130,404 KB
testcase_23 AC 283 ms
182,076 KB
testcase_24 AC 288 ms
182,084 KB
testcase_25 AC 254 ms
181,452 KB
testcase_26 AC 257 ms
182,128 KB
testcase_27 AC 96 ms
101,632 KB
testcase_28 AC 97 ms
102,144 KB
testcase_29 AC 97 ms
102,528 KB
testcase_30 AC 109 ms
104,192 KB
testcase_31 AC 170 ms
109,224 KB
testcase_32 AC 255 ms
181,100 KB
testcase_33 AC 141 ms
118,036 KB
testcase_34 AC 138 ms
118,164 KB
testcase_35 AC 104 ms
104,448 KB
testcase_36 AC 142 ms
106,620 KB
testcase_37 AC 139 ms
118,548 KB
testcase_38 AC 137 ms
116,628 KB
testcase_39 AC 109 ms
105,344 KB
testcase_40 AC 110 ms
105,472 KB
testcase_41 AC 239 ms
160,304 KB
testcase_42 AC 257 ms
160,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
import math


N = int(input())
A = list(map(int, input().split())) 
CA = collections.Counter(A)
B = []
for a in A:
    if a!=0:
        B.append(a)
B.sort()

CB= collections.Counter(B)
if len(CB)==1 or len(CA)==1:
    print('Yes')
    exit()
temp = 0
for i in range(len(B)-1):
    if B[i+1]-B[i]==0:
        print('No')
        exit()
    temp = math.gcd(temp,B[i+1]-B[i])
v = B[0]
while CA[0]>=0 and v<B[-1]:
    if CA[v]==0:
        CA[0]-=1
    v+=temp
if CA[0]<0:
    print('No')
else:
    print('Yes')
0