結果

問題 No.1884 Sequence
ユーザー rlangevinrlangevin
提出日時 2023-01-01 14:54:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 641 bytes
コンパイル時間 2,248 ms
コンパイル使用メモリ 86,592 KB
実行使用メモリ 164,848 KB
最終ジャッジ日時 2023-08-17 23:03:54
合計ジャッジ時間 8,481 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,268 KB
testcase_01 AC 70 ms
71,244 KB
testcase_02 AC 70 ms
71,228 KB
testcase_03 AC 70 ms
71,244 KB
testcase_04 AC 73 ms
71,556 KB
testcase_05 AC 70 ms
71,016 KB
testcase_06 AC 69 ms
71,432 KB
testcase_07 AC 72 ms
71,596 KB
testcase_08 AC 72 ms
71,300 KB
testcase_09 WA -
testcase_10 AC 258 ms
164,696 KB
testcase_11 AC 259 ms
164,732 KB
testcase_12 AC 98 ms
98,064 KB
testcase_13 AC 101 ms
100,720 KB
testcase_14 AC 103 ms
98,380 KB
testcase_15 AC 172 ms
126,540 KB
testcase_16 AC 209 ms
164,720 KB
testcase_17 AC 129 ms
107,220 KB
testcase_18 AC 155 ms
130,008 KB
testcase_19 AC 134 ms
104,488 KB
testcase_20 AC 153 ms
107,768 KB
testcase_21 AC 133 ms
108,756 KB
testcase_22 AC 169 ms
123,436 KB
testcase_23 AC 220 ms
164,392 KB
testcase_24 AC 213 ms
164,848 KB
testcase_25 AC 218 ms
164,088 KB
testcase_26 AC 216 ms
164,700 KB
testcase_27 AC 108 ms
104,020 KB
testcase_28 AC 103 ms
104,324 KB
testcase_29 AC 105 ms
104,340 KB
testcase_30 AC 109 ms
104,296 KB
testcase_31 AC 148 ms
102,232 KB
testcase_32 WA -
testcase_33 AC 138 ms
117,804 KB
testcase_34 AC 137 ms
117,804 KB
testcase_35 AC 107 ms
104,968 KB
testcase_36 AC 134 ms
107,044 KB
testcase_37 AC 161 ms
131,936 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 201 ms
146,668 KB
testcase_42 AC 200 ms
146,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

N = int(input())
A = list(map(int, input().split()))
L = []
zero = 0
for a in A:
    if a == 0:
        zero += 1
    else:
        L.append(a)
        
L.sort()
if len(set(L)) <= 1:
    print("Yes")
    exit()
D = []
for i in range(len(L) - 1):
    D.append(L[i + 1] - L[i])
minv = D[0]
for d in D:
    minv = gcd(minv, d)

if minv == 0:
    print("No")
    exit()
    
cnt = 0
for d in D:
    cnt += d - 1
if cnt <= zero:
    print("Yes")
    exit()


cnt = 0
for d in D:
    if d % minv != 0:
        print("No")
        exit()
    cnt += d // minv - 1
    
if cnt <= zero:
    print("Yes")
else:
    print("No")    
0