結果

問題 No.1093 区間の和 / Sum of Range
ユーザー ttrttr
提出日時 2020-06-28 16:12:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 637 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 19,844 KB
最終ジャッジ日時 2023-09-22 02:52:33
合計ジャッジ時間 15,363 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,072 KB
testcase_01 AC 341 ms
12,880 KB
testcase_02 AC 158 ms
9,492 KB
testcase_03 AC 91 ms
18,056 KB
testcase_04 AC 65 ms
19,772 KB
testcase_05 AC 488 ms
12,856 KB
testcase_06 AC 102 ms
12,024 KB
testcase_07 AC 267 ms
12,652 KB
testcase_08 AC 218 ms
18,992 KB
testcase_09 AC 424 ms
10,660 KB
testcase_10 AC 234 ms
16,252 KB
testcase_11 AC 453 ms
12,892 KB
testcase_12 AC 270 ms
15,336 KB
testcase_13 AC 18 ms
8,480 KB
testcase_14 AC 491 ms
11,652 KB
testcase_15 AC 121 ms
12,696 KB
testcase_16 AC 572 ms
15,468 KB
testcase_17 AC 480 ms
10,464 KB
testcase_18 AC 318 ms
11,560 KB
testcase_19 AC 39 ms
9,920 KB
testcase_20 AC 256 ms
9,736 KB
testcase_21 AC 551 ms
12,260 KB
testcase_22 AC 525 ms
15,776 KB
testcase_23 AC 395 ms
9,884 KB
testcase_24 AC 85 ms
18,416 KB
testcase_25 AC 477 ms
12,708 KB
testcase_26 AC 339 ms
15,608 KB
testcase_27 AC 512 ms
11,764 KB
testcase_28 AC 320 ms
16,180 KB
testcase_29 AC 637 ms
19,844 KB
testcase_30 AC 89 ms
10,268 KB
testcase_31 AC 116 ms
12,716 KB
testcase_32 AC 170 ms
13,908 KB
testcase_33 AC 534 ms
15,800 KB
testcase_34 AC 46 ms
9,176 KB
testcase_35 AC 553 ms
9,552 KB
testcase_36 AC 444 ms
18,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N,K = map(int, input().split())
A = [int(a) for a in input().split()]

num = sum(A[:K])
S = [num]
for i in range(N-K):
    num -= A[i]
    num += A[i+K]
    S.append(num)

S.sort()
Q = int(input())
for _ in range(Q):
    x = int(input())
    ans = bisect.bisect_right(S, x)
    print(ans)
0