結果

問題 No.1808 Fullgold Alchemist
ユーザー O2MTO2MT
提出日時 2022-01-15 18:21:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 106,576 KB
最終ジャッジ日時 2023-08-14 03:17:53
合計ジャッジ時間 5,617 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,420 KB
testcase_01 AC 57 ms
71,288 KB
testcase_02 AC 58 ms
71,024 KB
testcase_03 AC 58 ms
71,016 KB
testcase_04 AC 59 ms
71,172 KB
testcase_05 AC 85 ms
103,940 KB
testcase_06 AC 103 ms
106,576 KB
testcase_07 AC 93 ms
106,396 KB
testcase_08 AC 117 ms
99,452 KB
testcase_09 AC 112 ms
99,296 KB
testcase_10 AC 114 ms
99,412 KB
testcase_11 AC 124 ms
100,668 KB
testcase_12 AC 100 ms
106,052 KB
testcase_13 AC 104 ms
106,364 KB
testcase_14 AC 103 ms
106,180 KB
testcase_15 AC 109 ms
106,232 KB
testcase_16 AC 65 ms
75,908 KB
testcase_17 AC 58 ms
71,412 KB
testcase_18 AC 66 ms
78,904 KB
testcase_19 AC 63 ms
75,916 KB
testcase_20 AC 70 ms
81,100 KB
testcase_21 AC 63 ms
76,108 KB
testcase_22 AC 59 ms
71,524 KB
testcase_23 AC 62 ms
75,772 KB
testcase_24 AC 61 ms
75,844 KB
testcase_25 AC 62 ms
75,820 KB
testcase_26 AC 66 ms
78,108 KB
testcase_27 AC 69 ms
80,132 KB
testcase_28 AC 105 ms
100,072 KB
testcase_29 AC 76 ms
84,152 KB
testcase_30 AC 71 ms
82,928 KB
testcase_31 AC 99 ms
101,316 KB
testcase_32 AC 85 ms
90,648 KB
testcase_33 AC 91 ms
97,940 KB
testcase_34 AC 104 ms
99,712 KB
testcase_35 AC 90 ms
95,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_ok(x):
    stock = 0
    for a in A:
        if a+stock >= x:
            stock = stock+a-x
            continue
        return False
    return True


def meguru_bisect(ng, ok):
    '''
    初期値のng,okを受け取り,is_okを満たす最小(最大)のokを返す
    まずis_okを定義すべし
    ng ok は  とり得る最小の値-1 とり得る最大の値+1
    最大最小が逆の場合はよしなにひっくり返す
    '''
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

N,M = map(int,input().split())
A = list(map(int,input().split()))

ans = meguru_bisect(10**10,0)//M
print(ans)
0