結果

問題 No.1808 Fullgold Alchemist
ユーザー NatsubiSoganNatsubiSogan
提出日時 2022-01-14 22:14:33
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 1,770 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 10,668 KB
実行使用メモリ 30,712 KB
最終ジャッジ日時 2023-08-12 20:13:10
合計ジャッジ時間 13,472 ms
ジャッジサーバーID
(参考情報)
judge9 / judge7
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,824 KB
testcase_01 AC 15 ms
7,856 KB
testcase_02 AC 16 ms
7,780 KB
testcase_03 AC 15 ms
7,792 KB
testcase_04 AC 15 ms
7,836 KB
testcase_05 AC 94 ms
12,120 KB
testcase_06 AC 448 ms
20,408 KB
testcase_07 AC 117 ms
20,436 KB
testcase_08 AC 1,770 ms
30,664 KB
testcase_09 AC 366 ms
30,712 KB
testcase_10 AC 186 ms
30,668 KB
testcase_11 AC 384 ms
29,912 KB
testcase_12 AC 131 ms
28,000 KB
testcase_13 AC 491 ms
27,944 KB
testcase_14 AC 470 ms
27,984 KB
testcase_15 AC 547 ms
27,984 KB
testcase_16 AC 31 ms
8,516 KB
testcase_17 AC 15 ms
7,776 KB
testcase_18 AC 97 ms
11,024 KB
testcase_19 AC 20 ms
8,296 KB
testcase_20 AC 163 ms
12,764 KB
testcase_21 AC 42 ms
9,676 KB
testcase_22 AC 15 ms
7,852 KB
testcase_23 AC 25 ms
9,408 KB
testcase_24 AC 35 ms
8,720 KB
testcase_25 AC 29 ms
8,752 KB
testcase_26 AC 170 ms
11,116 KB
testcase_27 AC 231 ms
12,136 KB
testcase_28 AC 798 ms
28,184 KB
testcase_29 AC 255 ms
14,476 KB
testcase_30 AC 197 ms
13,732 KB
testcase_31 AC 1,041 ms
25,992 KB
testcase_32 AC 412 ms
18,884 KB
testcase_33 AC 1,035 ms
23,016 KB
testcase_34 AC 686 ms
27,820 KB
testcase_35 AC 756 ms
21,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
a = list(map(int, input().split()))
l, r = -1, 10 ** 9 + 1
while r - l > 1:
    mid = (l + r) // 2
    amari = 0
    for i in a:
        if i >= mid * m:
            amari += i - mid * m
        else:
            if amari < mid * m - i:
                r = mid
                break
            amari -= mid * m - i
    else: l = mid
print(l)
0