結果

問題 No.1884 Sequence
ユーザー 👑 rin204rin204
提出日時 2022-03-25 21:24:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 274 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 674 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 184,252 KB
最終ジャッジ日時 2023-08-04 08:08:37
合計ジャッジ時間 8,570 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,444 KB
testcase_01 AC 65 ms
71,276 KB
testcase_02 AC 65 ms
71,404 KB
testcase_03 AC 64 ms
71,320 KB
testcase_04 AC 60 ms
71,500 KB
testcase_05 AC 60 ms
71,116 KB
testcase_06 AC 63 ms
71,500 KB
testcase_07 AC 63 ms
71,696 KB
testcase_08 AC 62 ms
71,320 KB
testcase_09 AC 64 ms
71,440 KB
testcase_10 AC 274 ms
183,876 KB
testcase_11 AC 268 ms
183,904 KB
testcase_12 AC 91 ms
98,164 KB
testcase_13 AC 93 ms
100,928 KB
testcase_14 AC 96 ms
98,128 KB
testcase_15 AC 169 ms
135,520 KB
testcase_16 AC 224 ms
183,804 KB
testcase_17 AC 129 ms
106,988 KB
testcase_18 AC 162 ms
140,064 KB
testcase_19 AC 137 ms
109,876 KB
testcase_20 AC 157 ms
107,808 KB
testcase_21 AC 135 ms
108,872 KB
testcase_22 AC 175 ms
131,448 KB
testcase_23 AC 236 ms
183,808 KB
testcase_24 AC 226 ms
184,252 KB
testcase_25 AC 233 ms
183,452 KB
testcase_26 AC 231 ms
184,084 KB
testcase_27 AC 96 ms
104,404 KB
testcase_28 AC 93 ms
104,620 KB
testcase_29 AC 93 ms
104,476 KB
testcase_30 AC 93 ms
104,612 KB
testcase_31 AC 146 ms
110,100 KB
testcase_32 AC 237 ms
182,608 KB
testcase_33 AC 127 ms
117,952 KB
testcase_34 AC 130 ms
118,056 KB
testcase_35 AC 97 ms
105,268 KB
testcase_36 AC 122 ms
107,548 KB
testcase_37 AC 149 ms
120,084 KB
testcase_38 AC 140 ms
118,564 KB
testcase_39 AC 110 ms
107,944 KB
testcase_40 AC 107 ms
106,688 KB
testcase_41 AC 206 ms
160,440 KB
testcase_42 AC 202 ms
160,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

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

B = []
zero = 0
for a in A:
    if a != 0:
        B.append(a)
    else:
        zero += 1
if zero >= n - 1:
    print("Yes")
    exit()
if len(set(B)) == 1:
    print("Yes")
    exit()
B.sort()
b0 = B[0]
g = 0
for i, b in enumerate(B):
    B[i] -= b0
    g = gcd(g, b - b0)

B = [b // g for b in B]
if len(set(B)) == len(B) and B[-1] < n:
    print("Yes")
else:
    print("No")
0