結果

問題 No.1808 Fullgold Alchemist
ユーザー kokatsukokatsu
提出日時 2022-01-14 21:49:49
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 495 bytes
コンパイル時間 2,756 ms
コンパイル使用メモリ 204,156 KB
実行使用メモリ 12,600 KB
最終ジャッジ日時 2023-09-04 15:43:35
合計ジャッジ時間 5,150 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,508 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 18 ms
10,360 KB
testcase_06 AC 36 ms
11,436 KB
testcase_07 AC 33 ms
12,008 KB
testcase_08 AC 50 ms
11,904 KB
testcase_09 AC 49 ms
12,128 KB
testcase_10 AC 51 ms
12,092 KB
testcase_11 AC 46 ms
12,220 KB
testcase_12 AC 35 ms
10,920 KB
testcase_13 AC 38 ms
11,136 KB
testcase_14 AC 36 ms
10,880 KB
testcase_15 AC 37 ms
10,920 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 8 ms
4,564 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 10 ms
4,856 KB
testcase_21 AC 4 ms
4,380 KB
testcase_22 AC 2 ms
4,384 KB
testcase_23 AC 4 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 3 ms
4,380 KB
testcase_26 AC 8 ms
4,436 KB
testcase_27 AC 10 ms
4,516 KB
testcase_28 AC 42 ms
12,600 KB
testcase_29 AC 16 ms
5,896 KB
testcase_30 AC 14 ms
5,644 KB
testcase_31 AC 36 ms
11,252 KB
testcase_32 AC 23 ms
8,056 KB
testcase_33 AC 31 ms
9,912 KB
testcase_34 AC 42 ms
11,676 KB
testcase_35 AC 29 ms
9,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    long N, M;
    readf("%d %d\n", N, M);

    auto A = readln.chomp.split.to!(long[]);

    long ok, ng = long.max / 2;
    while (ng - ok > 1) {
        long mid = (ok + ng) / 2;

        bool isOK = true;
        long rem;
        foreach (a; A) {
            rem -= (mid - a);

            if (rem < 0) {
                isOK = false;
                break;
            }
        }

        (isOK ? ok : ng) = mid;
    }

    long res = ok / M;
    res.writeln;
}
0