結果

問題 No.1808 Fullgold Alchemist
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-01-14 21:43:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 111 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 104,388 KB
最終ジャッジ日時 2024-04-30 13:50:30
合計ジャッジ時間 3,683 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,224 KB
testcase_01 AC 33 ms
52,932 KB
testcase_02 AC 33 ms
53,288 KB
testcase_03 AC 35 ms
52,336 KB
testcase_04 AC 35 ms
52,428 KB
testcase_05 AC 69 ms
98,532 KB
testcase_06 AC 77 ms
104,388 KB
testcase_07 AC 74 ms
103,604 KB
testcase_08 AC 104 ms
102,480 KB
testcase_09 AC 104 ms
102,044 KB
testcase_10 AC 105 ms
102,340 KB
testcase_11 AC 111 ms
102,052 KB
testcase_12 AC 78 ms
103,036 KB
testcase_13 AC 89 ms
103,668 KB
testcase_14 AC 94 ms
104,020 KB
testcase_15 AC 95 ms
104,024 KB
testcase_16 AC 40 ms
61,936 KB
testcase_17 AC 32 ms
52,888 KB
testcase_18 AC 47 ms
68,336 KB
testcase_19 AC 42 ms
61,344 KB
testcase_20 AC 52 ms
73,012 KB
testcase_21 AC 43 ms
65,348 KB
testcase_22 AC 31 ms
52,608 KB
testcase_23 AC 41 ms
63,716 KB
testcase_24 AC 40 ms
63,016 KB
testcase_25 AC 42 ms
63,188 KB
testcase_26 AC 50 ms
67,452 KB
testcase_27 AC 54 ms
71,712 KB
testcase_28 AC 106 ms
103,800 KB
testcase_29 AC 59 ms
75,372 KB
testcase_30 AC 54 ms
72,992 KB
testcase_31 AC 98 ms
100,688 KB
testcase_32 AC 67 ms
85,476 KB
testcase_33 AC 84 ms
94,872 KB
testcase_34 AC 99 ms
103,928 KB
testcase_35 AC 83 ms
92,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
a = list(map(int,input().split()))
sum_ = sum(a)

def ok(s):
    tame = 0
    res = True
    for i in range(n):
        if a[i] < s:
            if tame + a[i] < s:
                res = False
                break
            else:
                tame -= s-a[i]
        else:
            tame += a[i] - s
    return res
l = -1
r = 10 ** 9 + 1
while r-l>1:
    mid = (l + r) // 2
    if ok(mid):
        l = mid
    else:
        r = mid
print(l//m)
0