結果

問題 No.1884 Sequence
ユーザー 👑 rin204rin204
提出日時 2022-03-25 21:24:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 82,096 KB
実行使用メモリ 182,480 KB
最終ジャッジ日時 2024-04-22 05:58:52
合計ジャッジ時間 7,019 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,224 KB
testcase_01 AC 42 ms
51,840 KB
testcase_02 AC 39 ms
51,712 KB
testcase_03 AC 38 ms
52,352 KB
testcase_04 AC 38 ms
52,096 KB
testcase_05 AC 38 ms
52,096 KB
testcase_06 AC 38 ms
51,712 KB
testcase_07 AC 38 ms
52,332 KB
testcase_08 AC 38 ms
52,096 KB
testcase_09 AC 42 ms
52,096 KB
testcase_10 AC 263 ms
181,896 KB
testcase_11 AC 261 ms
182,028 KB
testcase_12 AC 68 ms
88,832 KB
testcase_13 AC 70 ms
93,056 KB
testcase_14 AC 72 ms
92,032 KB
testcase_15 AC 151 ms
113,504 KB
testcase_16 AC 224 ms
181,888 KB
testcase_17 AC 113 ms
110,348 KB
testcase_18 AC 135 ms
117,824 KB
testcase_19 AC 119 ms
108,800 KB
testcase_20 AC 138 ms
106,624 KB
testcase_21 AC 116 ms
114,944 KB
testcase_22 AC 148 ms
109,912 KB
testcase_23 AC 223 ms
182,440 KB
testcase_24 AC 224 ms
182,480 KB
testcase_25 AC 228 ms
181,196 KB
testcase_26 AC 229 ms
182,112 KB
testcase_27 AC 77 ms
96,384 KB
testcase_28 AC 79 ms
96,896 KB
testcase_29 AC 78 ms
97,152 KB
testcase_30 AC 75 ms
96,896 KB
testcase_31 AC 134 ms
106,452 KB
testcase_32 AC 231 ms
180,572 KB
testcase_33 AC 115 ms
116,420 KB
testcase_34 AC 116 ms
116,128 KB
testcase_35 AC 80 ms
99,584 KB
testcase_36 AC 113 ms
106,448 KB
testcase_37 AC 142 ms
118,100 KB
testcase_38 AC 126 ms
116,516 KB
testcase_39 AC 96 ms
105,728 KB
testcase_40 AC 92 ms
107,392 KB
testcase_41 AC 197 ms
157,568 KB
testcase_42 AC 198 ms
156,796 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