結果

問題 No.1808 Fullgold Alchemist
ユーザー O2MTO2MT
提出日時 2022-01-15 18:17:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 711 bytes
コンパイル時間 403 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 103,040 KB
最終ジャッジ日時 2024-05-01 16:05:10
合計ジャッジ時間 4,571 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,224 KB
testcase_01 AC 38 ms
51,968 KB
testcase_02 AC 38 ms
51,968 KB
testcase_03 AC 39 ms
52,096 KB
testcase_04 WA -
testcase_05 AC 72 ms
95,872 KB
testcase_06 AC 91 ms
103,040 KB
testcase_07 AC 82 ms
102,400 KB
testcase_08 WA -
testcase_09 AC 109 ms
101,964 KB
testcase_10 AC 108 ms
101,996 KB
testcase_11 AC 112 ms
101,888 KB
testcase_12 AC 87 ms
101,504 KB
testcase_13 AC 92 ms
101,888 KB
testcase_14 AC 89 ms
101,888 KB
testcase_15 AC 91 ms
101,248 KB
testcase_16 AC 44 ms
59,648 KB
testcase_17 AC 40 ms
51,944 KB
testcase_18 AC 50 ms
65,536 KB
testcase_19 WA -
testcase_20 AC 53 ms
68,864 KB
testcase_21 AC 46 ms
62,336 KB
testcase_22 AC 38 ms
52,608 KB
testcase_23 AC 47 ms
60,696 KB
testcase_24 AC 44 ms
59,392 KB
testcase_25 AC 44 ms
59,648 KB
testcase_26 AC 49 ms
64,512 KB
testcase_27 AC 52 ms
67,456 KB
testcase_28 AC 91 ms
101,740 KB
testcase_29 AC 59 ms
73,140 KB
testcase_30 AC 57 ms
71,936 KB
testcase_31 AC 96 ms
97,792 KB
testcase_32 WA -
testcase_33 AC 83 ms
92,288 KB
testcase_34 AC 91 ms
101,792 KB
testcase_35 AC 78 ms
89,088 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