結果

問題 No.2217 Suffix+
ユーザー 👑 kakel-sankakel-san
提出日時 2023-08-26 19:44:06
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 215 ms / 2,000 ms
コード長 1,012 bytes
コンパイル時間 1,587 ms
コンパイル使用メモリ 61,552 KB
実行使用メモリ 40,708 KB
最終ジャッジ日時 2023-08-26 19:44:15
合計ジャッジ時間 8,920 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,908 KB
testcase_01 AC 60 ms
21,804 KB
testcase_02 AC 59 ms
21,824 KB
testcase_03 AC 59 ms
21,708 KB
testcase_04 AC 59 ms
21,824 KB
testcase_05 AC 59 ms
21,780 KB
testcase_06 AC 59 ms
21,872 KB
testcase_07 AC 58 ms
21,916 KB
testcase_08 AC 58 ms
19,876 KB
testcase_09 AC 59 ms
21,816 KB
testcase_10 AC 60 ms
21,920 KB
testcase_11 AC 59 ms
21,872 KB
testcase_12 AC 60 ms
21,772 KB
testcase_13 AC 60 ms
25,896 KB
testcase_14 AC 80 ms
23,064 KB
testcase_15 AC 83 ms
23,604 KB
testcase_16 AC 96 ms
28,976 KB
testcase_17 AC 87 ms
24,552 KB
testcase_18 AC 83 ms
21,480 KB
testcase_19 AC 142 ms
28,912 KB
testcase_20 AC 137 ms
28,312 KB
testcase_21 AC 81 ms
22,676 KB
testcase_22 AC 142 ms
28,640 KB
testcase_23 AC 130 ms
26,964 KB
testcase_24 AC 162 ms
38,256 KB
testcase_25 AC 136 ms
36,092 KB
testcase_26 AC 138 ms
38,216 KB
testcase_27 AC 138 ms
38,188 KB
testcase_28 AC 135 ms
38,160 KB
testcase_29 AC 189 ms
40,296 KB
testcase_30 AC 189 ms
40,196 KB
testcase_31 AC 213 ms
40,228 KB
testcase_32 AC 188 ms
40,376 KB
testcase_33 AC 188 ms
40,232 KB
testcase_34 AC 139 ms
40,708 KB
testcase_35 AC 58 ms
19,780 KB
testcase_36 AC 215 ms
40,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, k) = (c[0], c[1]);
        var a = NList;
        var ok = 0L;
        var ng = 1_000_000_000_000_000;
        while (ng - ok > 1)
        {
            var mid = (ok + ng) / 2;
            var cnt = 0L;
            var add = 0L;
            for (var i = 0; i < n; ++i)
            {
                if (a[i] + add < mid)
                {
                    var sub = (mid - add - a[i] + i) / (i + 1);
                    cnt += sub;
                    add += sub * (i + 1);
                }
            }
            if (cnt > k) ng = mid;
            else ok = mid;
        }
        WriteLine(ok);
    }
}
0