結果

問題 No.2217 Suffix+
ユーザー 👑 H20H20
提出日時 2023-02-17 21:57:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 222 ms / 2,000 ms
コード長 479 bytes
コンパイル時間 1,300 ms
コンパイル使用メモリ 86,468 KB
実行使用メモリ 92,436 KB
最終ジャッジ日時 2023-09-26 19:14:53
合計ジャッジ時間 7,643 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
70,852 KB
testcase_01 AC 75 ms
70,776 KB
testcase_02 AC 74 ms
70,788 KB
testcase_03 AC 76 ms
71,044 KB
testcase_04 AC 74 ms
70,900 KB
testcase_05 AC 75 ms
71,092 KB
testcase_06 AC 75 ms
70,932 KB
testcase_07 AC 75 ms
70,944 KB
testcase_08 AC 76 ms
71,040 KB
testcase_09 AC 74 ms
70,864 KB
testcase_10 AC 75 ms
70,896 KB
testcase_11 AC 76 ms
70,772 KB
testcase_12 AC 77 ms
70,824 KB
testcase_13 AC 74 ms
70,948 KB
testcase_14 AC 92 ms
77,972 KB
testcase_15 AC 90 ms
77,884 KB
testcase_16 AC 102 ms
82,960 KB
testcase_17 AC 93 ms
80,232 KB
testcase_18 AC 90 ms
78,980 KB
testcase_19 AC 176 ms
86,844 KB
testcase_20 AC 167 ms
85,276 KB
testcase_21 AC 95 ms
75,604 KB
testcase_22 AC 175 ms
86,716 KB
testcase_23 AC 157 ms
83,096 KB
testcase_24 AC 121 ms
91,976 KB
testcase_25 AC 122 ms
92,208 KB
testcase_26 AC 121 ms
92,156 KB
testcase_27 AC 121 ms
92,172 KB
testcase_28 AC 123 ms
92,148 KB
testcase_29 AC 214 ms
92,280 KB
testcase_30 AC 214 ms
92,388 KB
testcase_31 AC 214 ms
92,436 KB
testcase_32 AC 213 ms
92,360 KB
testcase_33 AC 215 ms
92,372 KB
testcase_34 AC 122 ms
92,208 KB
testcase_35 AC 75 ms
70,664 KB
testcase_36 AC 222 ms
92,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_ok(V):
    cnt = 0
    add = 0
    for i,a in enumerate(A,start=1):
        if add+a<V:
            temp = -(-(V-a-add)//i)
            add+=temp*i
            cnt+=temp
    return cnt<=K

def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok




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

print(meguru_bisect(10**18,0))
0