結果

問題 No.1808 Fullgold Alchemist
ユーザー O2MTO2MT
提出日時 2022-01-15 18:21:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 716 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 81,924 KB
実行使用メモリ 102,400 KB
最終ジャッジ日時 2024-05-01 16:09:30
合計ジャッジ時間 4,200 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,004 KB
testcase_01 AC 37 ms
52,096 KB
testcase_02 AC 35 ms
52,096 KB
testcase_03 AC 35 ms
51,968 KB
testcase_04 AC 36 ms
52,096 KB
testcase_05 AC 71 ms
96,000 KB
testcase_06 AC 87 ms
102,400 KB
testcase_07 AC 73 ms
102,272 KB
testcase_08 AC 96 ms
101,888 KB
testcase_09 AC 96 ms
101,888 KB
testcase_10 AC 97 ms
101,888 KB
testcase_11 AC 104 ms
102,052 KB
testcase_12 AC 76 ms
101,248 KB
testcase_13 AC 84 ms
101,376 KB
testcase_14 AC 79 ms
101,632 KB
testcase_15 AC 82 ms
101,504 KB
testcase_16 AC 42 ms
59,528 KB
testcase_17 AC 34 ms
52,096 KB
testcase_18 AC 44 ms
65,536 KB
testcase_19 AC 38 ms
59,264 KB
testcase_20 AC 49 ms
68,480 KB
testcase_21 AC 40 ms
61,696 KB
testcase_22 AC 33 ms
52,096 KB
testcase_23 AC 39 ms
60,672 KB
testcase_24 AC 38 ms
59,264 KB
testcase_25 AC 40 ms
59,776 KB
testcase_26 AC 45 ms
64,944 KB
testcase_27 AC 47 ms
67,456 KB
testcase_28 AC 83 ms
102,344 KB
testcase_29 AC 53 ms
73,088 KB
testcase_30 AC 49 ms
71,168 KB
testcase_31 AC 80 ms
97,152 KB
testcase_32 AC 62 ms
82,684 KB
testcase_33 AC 72 ms
91,904 KB
testcase_34 AC 82 ms
101,632 KB
testcase_35 AC 69 ms
89,088 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