結果

問題 No.1808 Fullgold Alchemist
ユーザー O2MTO2MT
提出日時 2022-01-15 18:17:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 711 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 106,768 KB
最終ジャッジ日時 2023-08-14 03:13:03
合計ジャッジ時間 5,641 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
71,100 KB
testcase_01 AC 59 ms
71,244 KB
testcase_02 AC 59 ms
71,036 KB
testcase_03 AC 60 ms
71,396 KB
testcase_04 WA -
testcase_05 AC 85 ms
103,612 KB
testcase_06 AC 99 ms
106,768 KB
testcase_07 AC 93 ms
106,348 KB
testcase_08 WA -
testcase_09 AC 109 ms
99,412 KB
testcase_10 AC 115 ms
99,404 KB
testcase_11 AC 117 ms
100,476 KB
testcase_12 AC 100 ms
106,400 KB
testcase_13 AC 105 ms
106,256 KB
testcase_14 AC 105 ms
106,272 KB
testcase_15 AC 100 ms
106,080 KB
testcase_16 AC 65 ms
75,920 KB
testcase_17 AC 63 ms
71,280 KB
testcase_18 AC 71 ms
79,036 KB
testcase_19 WA -
testcase_20 AC 75 ms
81,604 KB
testcase_21 AC 66 ms
76,056 KB
testcase_22 AC 60 ms
71,256 KB
testcase_23 AC 63 ms
75,844 KB
testcase_24 AC 62 ms
75,876 KB
testcase_25 AC 65 ms
75,848 KB
testcase_26 AC 70 ms
78,324 KB
testcase_27 AC 71 ms
80,012 KB
testcase_28 AC 114 ms
99,804 KB
testcase_29 AC 78 ms
84,056 KB
testcase_30 AC 77 ms
82,844 KB
testcase_31 AC 104 ms
101,176 KB
testcase_32 WA -
testcase_33 AC 101 ms
97,572 KB
testcase_34 AC 109 ms
99,952 KB
testcase_35 AC 95 ms
95,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_ok(x):
    stock = 0
    for a in A:
        if a+stock >= x:
            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):
            ng = mid
        else:
            ok = mid
    return ok

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

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