結果

問題 No.1093 区間の和 / Sum of Range
ユーザー hiragnhiragn
提出日時 2022-12-02 15:57:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 645 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 23,784 KB
最終ジャッジ日時 2024-04-17 23:56:11
合計ジャッジ時間 14,186 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
10,880 KB
testcase_01 AC 349 ms
15,096 KB
testcase_02 AC 175 ms
12,032 KB
testcase_03 AC 101 ms
21,100 KB
testcase_04 AC 82 ms
20,432 KB
testcase_05 AC 496 ms
14,984 KB
testcase_06 AC 118 ms
14,512 KB
testcase_07 AC 281 ms
15,100 KB
testcase_08 AC 221 ms
20,820 KB
testcase_09 AC 442 ms
13,568 KB
testcase_10 AC 243 ms
18,248 KB
testcase_11 AC 460 ms
16,180 KB
testcase_12 AC 274 ms
18,736 KB
testcase_13 AC 34 ms
11,008 KB
testcase_14 AC 588 ms
15,024 KB
testcase_15 AC 131 ms
14,820 KB
testcase_16 AC 582 ms
17,552 KB
testcase_17 AC 492 ms
12,928 KB
testcase_18 AC 319 ms
15,136 KB
testcase_19 AC 56 ms
12,160 KB
testcase_20 AC 268 ms
12,032 KB
testcase_21 AC 569 ms
14,788 KB
testcase_22 AC 535 ms
18,124 KB
testcase_23 AC 408 ms
12,404 KB
testcase_24 AC 101 ms
19,460 KB
testcase_25 AC 500 ms
14,912 KB
testcase_26 AC 348 ms
19,012 KB
testcase_27 AC 528 ms
14,648 KB
testcase_28 AC 335 ms
18,832 KB
testcase_29 AC 645 ms
23,784 KB
testcase_30 AC 105 ms
12,512 KB
testcase_31 AC 126 ms
15,360 KB
testcase_32 AC 190 ms
16,076 KB
testcase_33 AC 528 ms
18,084 KB
testcase_34 AC 60 ms
11,520 KB
testcase_35 AC 560 ms
11,904 KB
testcase_36 AC 448 ms
20,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right
from itertools import accumulate


def main():
    n, k = map(int, input().split())
    a = list(map(int, input().split()))

    acc = list(accumulate(a))
    s = [acc[k - 1]] + [acc[i + k - 1] - acc[i - 1] for i in range(1, n - k + 1)]
    s.sort()

    q = int(input())
    for _ in range(q):
        x = int(input())
        print(bisect_right(s, x))


if __name__ == "__main__":
    main()
0