結果

問題 No.989 N×Mマス計算(K以上)
ユーザー kokatsukokatsu
提出日時 2021-11-24 21:47:42
言語 D
(dmd 2.105.2)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 455 bytes
コンパイル時間 3,431 ms
コンパイル使用メモリ 210,668 KB
実行使用メモリ 8,772 KB
最終ジャッジ日時 2023-09-04 15:07:56
合計ジャッジ時間 3,823 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 36 ms
5,736 KB
testcase_11 AC 30 ms
6,616 KB
testcase_12 AC 39 ms
6,748 KB
testcase_13 AC 19 ms
7,304 KB
testcase_14 AC 55 ms
8,772 KB
testcase_15 AC 16 ms
4,384 KB
testcase_16 AC 29 ms
4,796 KB
testcase_17 AC 19 ms
6,176 KB
testcase_18 AC 23 ms
4,376 KB
testcase_19 AC 31 ms
7,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

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

    auto input = readln.chomp.split;
    string op = input[0];
    auto B = input[1..$].to!(long[]).sort;

    long res;
    foreach (i; 0 .. N) {
        long A;
        readf("%d\n", A);

        if (op == "+") {
            res += B.upperBound(K-A-1).length;
        }
        else {
            res += B.upperBound((K+A-1)/A-1).length;
        }
    }

    res.writeln;
}
0