結果

問題 No.1093 区間の和 / Sum of Range
ユーザー kokatsukokatsu
提出日時 2022-10-07 00:25:52
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 504 bytes
コンパイル時間 3,162 ms
コンパイル使用メモリ 210,460 KB
実行使用メモリ 9,012 KB
最終ジャッジ日時 2023-09-04 18:30:40
合計ジャッジ時間 9,749 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 49 ms
5,084 KB
testcase_02 AC 22 ms
4,376 KB
testcase_03 AC 28 ms
7,388 KB
testcase_04 AC 21 ms
8,756 KB
testcase_05 AC 68 ms
4,724 KB
testcase_06 AC 18 ms
4,728 KB
testcase_07 AC 40 ms
5,088 KB
testcase_08 AC 42 ms
8,304 KB
testcase_09 AC 57 ms
4,548 KB
testcase_10 AC 43 ms
7,936 KB
testcase_11 AC 56 ms
5,112 KB
testcase_12 AC 44 ms
7,596 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 59 ms
4,704 KB
testcase_15 AC 20 ms
5,084 KB
testcase_16 AC 73 ms
7,024 KB
testcase_17 AC 54 ms
4,384 KB
testcase_18 AC 40 ms
4,912 KB
testcase_19 AC 6 ms
4,376 KB
testcase_20 AC 31 ms
4,380 KB
testcase_21 AC 70 ms
4,716 KB
testcase_22 AC 74 ms
7,600 KB
testcase_23 AC 47 ms
4,388 KB
testcase_24 AC 21 ms
7,460 KB
testcase_25 AC 58 ms
4,816 KB
testcase_26 AC 54 ms
7,596 KB
testcase_27 AC 62 ms
4,660 KB
testcase_28 AC 50 ms
7,084 KB
testcase_29 AC 94 ms
9,012 KB
testcase_30 AC 13 ms
4,412 KB
testcase_31 AC 21 ms
6,548 KB
testcase_32 AC 27 ms
5,156 KB
testcase_33 AC 72 ms
7,624 KB
testcase_34 AC 6 ms
4,380 KB
testcase_35 AC 63 ms
4,376 KB
testcase_36 AC 68 ms
7,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

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

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

    long num;
    long[] S;
    foreach (i, x; a) {
        num += x;

        if (i >= K - 1) {
            S ~= num;
            num -= a[i-K+1];
        }
    }

    auto T = S.sort;

    long Q;
    readf("%d\n", Q);

    foreach (_; 0 .. Q) {
        long x;
        readf("%d\n", x);

        auto lb = T.lowerBound(x+1);

        auto res = lb.length;
        res.writeln;
    }
}
0