結果

問題 No.1093 区間の和 / Sum of Range
ユーザー ThetaTheta
提出日時 2022-10-20 11:48:51
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 581 ms / 2,000 ms
コード長 478 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 10,548 KB
実行使用メモリ 19,740 KB
最終ジャッジ日時 2023-09-12 17:53:10
合計ジャッジ時間 12,747 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,892 KB
testcase_01 AC 310 ms
12,856 KB
testcase_02 AC 150 ms
9,448 KB
testcase_03 AC 74 ms
18,028 KB
testcase_04 AC 56 ms
19,700 KB
testcase_05 AC 453 ms
12,680 KB
testcase_06 AC 95 ms
11,832 KB
testcase_07 AC 245 ms
12,584 KB
testcase_08 AC 194 ms
18,996 KB
testcase_09 AC 399 ms
10,696 KB
testcase_10 AC 214 ms
16,284 KB
testcase_11 AC 418 ms
12,840 KB
testcase_12 AC 242 ms
15,432 KB
testcase_13 AC 18 ms
8,492 KB
testcase_14 AC 458 ms
11,488 KB
testcase_15 AC 110 ms
12,680 KB
testcase_16 AC 526 ms
15,408 KB
testcase_17 AC 446 ms
10,356 KB
testcase_18 AC 294 ms
11,564 KB
testcase_19 AC 37 ms
9,832 KB
testcase_20 AC 238 ms
9,864 KB
testcase_21 AC 520 ms
12,244 KB
testcase_22 AC 486 ms
15,856 KB
testcase_23 AC 370 ms
9,996 KB
testcase_24 AC 77 ms
18,452 KB
testcase_25 AC 450 ms
12,616 KB
testcase_26 AC 312 ms
15,660 KB
testcase_27 AC 474 ms
11,696 KB
testcase_28 AC 292 ms
16,132 KB
testcase_29 AC 581 ms
19,740 KB
testcase_30 AC 83 ms
10,252 KB
testcase_31 AC 104 ms
12,752 KB
testcase_32 AC 161 ms
13,724 KB
testcase_33 AC 490 ms
15,760 KB
testcase_34 AC 44 ms
8,968 KB
testcase_35 AC 523 ms
9,380 KB
testcase_36 AC 404 ms
18,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right


def main():
    N, K = map(int, input().split())
    a = list(map(int, input().split()))

    range_sum = []
    for i in range(N-K+1):
        if not range_sum:
            range_sum.append(sum(a[:K]))
        else:
            range_sum.append(range_sum[-1] + a[i+K-1] - a[i-1])
    range_sum.sort()

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


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