結果

問題 No.2217 Suffix+
ユーザー maguroflymagurofly
提出日時 2023-02-17 21:46:54
言語 Ruby
(3.2.2)
結果
AC  
実行時間 1,346 ms / 2,000 ms
コード長 404 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 11,252 KB
実行使用メモリ 24,916 KB
最終ジャッジ日時 2023-09-26 19:02:07
合計ジャッジ時間 19,425 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,220 KB
testcase_01 AC 81 ms
15,048 KB
testcase_02 AC 79 ms
15,268 KB
testcase_03 AC 78 ms
15,300 KB
testcase_04 AC 79 ms
15,308 KB
testcase_05 AC 79 ms
15,252 KB
testcase_06 AC 80 ms
15,176 KB
testcase_07 AC 79 ms
15,292 KB
testcase_08 AC 79 ms
15,096 KB
testcase_09 AC 80 ms
15,152 KB
testcase_10 AC 79 ms
15,096 KB
testcase_11 AC 79 ms
15,248 KB
testcase_12 AC 79 ms
15,232 KB
testcase_13 AC 80 ms
15,260 KB
testcase_14 AC 229 ms
17,632 KB
testcase_15 AC 229 ms
17,572 KB
testcase_16 AC 390 ms
20,176 KB
testcase_17 AC 311 ms
18,936 KB
testcase_18 AC 265 ms
17,756 KB
testcase_19 AC 783 ms
20,880 KB
testcase_20 AC 724 ms
20,544 KB
testcase_21 AC 206 ms
15,444 KB
testcase_22 AC 757 ms
20,660 KB
testcase_23 AC 641 ms
20,208 KB
testcase_24 AC 652 ms
24,796 KB
testcase_25 AC 654 ms
24,756 KB
testcase_26 AC 654 ms
24,760 KB
testcase_27 AC 654 ms
24,820 KB
testcase_28 AC 661 ms
24,752 KB
testcase_29 AC 1,229 ms
24,764 KB
testcase_30 AC 1,230 ms
24,760 KB
testcase_31 AC 1,229 ms
24,816 KB
testcase_32 AC 1,225 ms
24,756 KB
testcase_33 AC 1,230 ms
24,892 KB
testcase_34 AC 664 ms
24,916 KB
testcase_35 AC 80 ms
15,292 KB
testcase_36 AC 1,346 ms
24,804 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

ac = 0
wa = 10**20
while wa - ac > 1
    wj = (ac + wa) >> 1
    
    add = 0
    count = 0
    N.times do |i|
        if A[i] + add < wj
            c = (wj - (A[i] + add) + i) / (i + 1)
            count += c
            add += c * (i + 1)
        end
    end
    
    if count <= K
        ac = wj
    else
        wa = wj
    end
end

puts ac
0