結果

問題 No.1808 Fullgold Alchemist
ユーザー SidewaysOwlSidewaysOwl
提出日時 2022-01-14 21:43:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 87,076 KB
実行使用メモリ 107,116 KB
最終ジャッジ日時 2023-08-12 18:45:09
合計ジャッジ時間 6,127 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,148 KB
testcase_01 AC 70 ms
71,280 KB
testcase_02 AC 74 ms
71,540 KB
testcase_03 AC 72 ms
71,272 KB
testcase_04 AC 70 ms
71,380 KB
testcase_05 AC 108 ms
104,440 KB
testcase_06 AC 117 ms
107,116 KB
testcase_07 AC 112 ms
106,896 KB
testcase_08 AC 143 ms
99,608 KB
testcase_09 AC 141 ms
99,800 KB
testcase_10 AC 142 ms
99,624 KB
testcase_11 AC 151 ms
100,344 KB
testcase_12 AC 117 ms
106,584 KB
testcase_13 AC 131 ms
106,976 KB
testcase_14 AC 136 ms
106,900 KB
testcase_15 AC 141 ms
106,992 KB
testcase_16 AC 80 ms
76,144 KB
testcase_17 AC 72 ms
71,152 KB
testcase_18 AC 88 ms
79,212 KB
testcase_19 AC 77 ms
76,360 KB
testcase_20 AC 91 ms
81,504 KB
testcase_21 AC 83 ms
76,568 KB
testcase_22 AC 70 ms
71,320 KB
testcase_23 AC 80 ms
76,168 KB
testcase_24 AC 78 ms
76,144 KB
testcase_25 AC 81 ms
76,028 KB
testcase_26 AC 87 ms
78,308 KB
testcase_27 AC 93 ms
80,160 KB
testcase_28 AC 155 ms
99,812 KB
testcase_29 AC 100 ms
84,532 KB
testcase_30 AC 91 ms
83,252 KB
testcase_31 AC 137 ms
101,564 KB
testcase_32 AC 110 ms
90,852 KB
testcase_33 AC 125 ms
98,092 KB
testcase_34 AC 142 ms
99,744 KB
testcase_35 AC 122 ms
95,560 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