結果

問題 No.1884 Sequence
ユーザー n_nan_na
提出日時 2022-03-26 00:15:23
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 675 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 136,232 KB
最終ジャッジ日時 2024-04-22 09:24:30
合計ジャッジ時間 6,505 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,840 KB
testcase_01 AC 38 ms
51,840 KB
testcase_02 AC 38 ms
51,712 KB
testcase_03 AC 39 ms
51,968 KB
testcase_04 AC 39 ms
51,840 KB
testcase_05 AC 38 ms
51,840 KB
testcase_06 WA -
testcase_07 AC 38 ms
51,968 KB
testcase_08 AC 38 ms
51,456 KB
testcase_09 AC 38 ms
51,584 KB
testcase_10 AC 182 ms
135,568 KB
testcase_11 AC 172 ms
136,232 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 72 ms
91,104 KB
testcase_15 AC 138 ms
107,136 KB
testcase_16 AC 160 ms
135,468 KB
testcase_17 AC 102 ms
115,032 KB
testcase_18 AC 108 ms
107,436 KB
testcase_19 AC 104 ms
117,000 KB
testcase_20 AC 131 ms
118,656 KB
testcase_21 AC 121 ms
112,964 KB
testcase_22 AC 135 ms
119,448 KB
testcase_23 AC 162 ms
135,456 KB
testcase_24 AC 171 ms
135,332 KB
testcase_25 AC 164 ms
134,580 KB
testcase_26 AC 165 ms
136,168 KB
testcase_27 AC 70 ms
95,288 KB
testcase_28 AC 69 ms
95,332 KB
testcase_29 AC 71 ms
95,564 KB
testcase_30 AC 70 ms
95,920 KB
testcase_31 AC 110 ms
112,580 KB
testcase_32 AC 164 ms
134,636 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 81 ms
98,552 KB
testcase_36 AC 107 ms
102,228 KB
testcase_37 AC 101 ms
102,520 KB
testcase_38 AC 100 ms
100,572 KB
testcase_39 AC 86 ms
101,488 KB
testcase_40 AC 89 ms
101,808 KB
testcase_41 AC 158 ms
122,924 KB
testcase_42 AC 158 ms
122,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
num = A.count(0)

s = set(A)

A.sort(reverse = True)
d = 10**16

for i in range(N-1):
    if A[i+1] == 0:
        break
    tmp = A[i] - A[i+1]
    d = min(tmp, d)

if num >= N-1:
    ans = "Yes"
elif d == 0:
    if 0 in s and len(s) == 2:
        ans = "Yes"
    else:
        ans = "No"
else:
    ans = "Yes"
    for i in range(N-1):
        if A[i+1] == 0:
            break
        diff = A[i] - A[i+1]
        if diff == d:
            continue
        if diff%d != 0:
            ans = "No"
        elif diff%d == 0:
            num -= diff//d - 1
            if num < 0:
                ans = "No"
    
print(ans)

0