結果

問題 No.2217 Suffix+
ユーザー ikomaikoma
提出日時 2023-02-17 22:01:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 533 ms
コンパイル使用メモリ 86,876 KB
実行使用メモリ 91,416 KB
最終ジャッジ日時 2023-09-26 19:18:24
合計ジャッジ時間 6,218 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,224 KB
testcase_01 AC 71 ms
71,052 KB
testcase_02 AC 70 ms
71,052 KB
testcase_03 AC 71 ms
71,200 KB
testcase_04 AC 69 ms
71,236 KB
testcase_05 AC 69 ms
71,236 KB
testcase_06 AC 69 ms
70,932 KB
testcase_07 AC 70 ms
70,932 KB
testcase_08 AC 70 ms
71,288 KB
testcase_09 AC 70 ms
71,212 KB
testcase_10 AC 69 ms
71,116 KB
testcase_11 AC 68 ms
71,096 KB
testcase_12 AC 70 ms
71,116 KB
testcase_13 AC 68 ms
71,084 KB
testcase_14 AC 79 ms
77,724 KB
testcase_15 AC 80 ms
78,304 KB
testcase_16 AC 87 ms
82,420 KB
testcase_17 AC 82 ms
79,920 KB
testcase_18 AC 82 ms
79,376 KB
testcase_19 AC 120 ms
86,776 KB
testcase_20 AC 115 ms
85,164 KB
testcase_21 AC 80 ms
76,016 KB
testcase_22 AC 123 ms
86,756 KB
testcase_23 AC 116 ms
82,916 KB
testcase_24 AC 106 ms
91,020 KB
testcase_25 AC 108 ms
90,628 KB
testcase_26 AC 102 ms
90,904 KB
testcase_27 AC 106 ms
91,020 KB
testcase_28 AC 104 ms
90,948 KB
testcase_29 AC 184 ms
91,416 KB
testcase_30 AC 184 ms
91,412 KB
testcase_31 AC 186 ms
91,240 KB
testcase_32 AC 184 ms
91,240 KB
testcase_33 AC 186 ms
91,192 KB
testcase_34 AC 102 ms
91,000 KB
testcase_35 AC 69 ms
70,932 KB
testcase_36 AC 205 ms
91,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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

def judge(x):
    k=K
    s=0
    for i,a in enumerate(A,start=1):
        if a+s>=x:continue
        d = x-(a+s)
        p=(d+i-1)//i
        k-=p
        if k<0:return False
        s+=i*p
    return True

ok,ng=0,10**15
while ok+1<ng:
    m=ok+ng>>1
    if judge(m):
        ok=m
    else:
        ng=m
print(ok)

0