結果

問題 No.1808 Fullgold Alchemist
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2022-01-14 22:37:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 517 ms
コンパイル使用メモリ 87,008 KB
実行使用メモリ 107,280 KB
最終ジャッジ日時 2023-08-12 21:03:34
合計ジャッジ時間 6,230 ms
ジャッジサーバーID
(参考情報)
judge10 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,192 KB
testcase_01 AC 72 ms
71,092 KB
testcase_02 AC 73 ms
71,372 KB
testcase_03 AC 72 ms
71,132 KB
testcase_04 AC 73 ms
71,316 KB
testcase_05 AC 108 ms
103,832 KB
testcase_06 AC 121 ms
107,280 KB
testcase_07 AC 111 ms
106,520 KB
testcase_08 AC 138 ms
99,416 KB
testcase_09 AC 129 ms
99,616 KB
testcase_10 AC 124 ms
99,380 KB
testcase_11 AC 130 ms
100,480 KB
testcase_12 AC 114 ms
106,224 KB
testcase_13 AC 132 ms
106,736 KB
testcase_14 AC 141 ms
106,828 KB
testcase_15 AC 143 ms
107,028 KB
testcase_16 AC 80 ms
76,340 KB
testcase_17 AC 71 ms
71,176 KB
testcase_18 AC 87 ms
79,364 KB
testcase_19 AC 76 ms
76,248 KB
testcase_20 AC 90 ms
81,416 KB
testcase_21 AC 79 ms
76,368 KB
testcase_22 AC 71 ms
71,360 KB
testcase_23 AC 81 ms
75,888 KB
testcase_24 AC 80 ms
76,420 KB
testcase_25 AC 82 ms
76,060 KB
testcase_26 AC 90 ms
78,656 KB
testcase_27 AC 95 ms
80,396 KB
testcase_28 AC 140 ms
99,872 KB
testcase_29 AC 99 ms
84,432 KB
testcase_30 AC 96 ms
83,044 KB
testcase_31 AC 134 ms
101,760 KB
testcase_32 AC 111 ms
91,140 KB
testcase_33 AC 125 ms
97,992 KB
testcase_34 AC 138 ms
99,932 KB
testcase_35 AC 121 ms
95,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
A = list(map(int,input().split()))

def calc(x):
    count = 0
    for a in A:
        if a >= x*m:
            count += a-x*m
        else:
            count -= x*m-a
        if count < 0:
            return 0

    return 1
l = 0
r = 10**10
while r > l + 1:
    c = (r+l)//2

    if calc(c):
        l = c
    else:
        r = c

print(l)
0