結果

問題 No.1093 区間の和 / Sum of Range
ユーザー roarisroaris
提出日時 2020-06-24 03:23:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 289 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 102,612 KB
最終ジャッジ日時 2023-09-16 20:38:27
合計ジャッジ時間 6,858 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,288 KB
testcase_01 AC 133 ms
85,324 KB
testcase_02 AC 112 ms
77,816 KB
testcase_03 AC 135 ms
98,572 KB
testcase_04 AC 106 ms
97,336 KB
testcase_05 AC 149 ms
83,460 KB
testcase_06 AC 112 ms
82,420 KB
testcase_07 AC 130 ms
83,396 KB
testcase_08 AC 143 ms
99,004 KB
testcase_09 AC 138 ms
79,428 KB
testcase_10 AC 134 ms
91,508 KB
testcase_11 AC 126 ms
85,240 KB
testcase_12 AC 132 ms
91,432 KB
testcase_13 AC 79 ms
76,508 KB
testcase_14 AC 135 ms
81,992 KB
testcase_15 AC 107 ms
83,820 KB
testcase_16 AC 150 ms
89,868 KB
testcase_17 AC 120 ms
78,688 KB
testcase_18 AC 117 ms
81,748 KB
testcase_19 AC 93 ms
77,964 KB
testcase_20 AC 113 ms
78,032 KB
testcase_21 AC 145 ms
82,368 KB
testcase_22 AC 157 ms
89,856 KB
testcase_23 AC 120 ms
78,216 KB
testcase_24 AC 113 ms
93,572 KB
testcase_25 AC 125 ms
83,608 KB
testcase_26 AC 141 ms
92,848 KB
testcase_27 AC 128 ms
82,440 KB
testcase_28 AC 136 ms
91,832 KB
testcase_29 AC 175 ms
102,612 KB
testcase_30 AC 95 ms
78,956 KB
testcase_31 AC 106 ms
84,432 KB
testcase_32 AC 119 ms
85,352 KB
testcase_33 AC 154 ms
91,284 KB
testcase_34 AC 91 ms
77,664 KB
testcase_35 AC 125 ms
78,252 KB
testcase_36 AC 152 ms
97,016 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from bisect import *

N, K = map(int, input().split())
a = list(map(int, input().split()))
acc = [0]

for ai in a:
    acc.append(acc[-1]+ai)

l = []

for i in range(N-K+1):
    l.append(acc[i+K]-acc[i])

l.sort()
Q = int(input())

for _ in range(Q):
    x = int(input())
    print(bisect_right(l, x))
0