結果

問題 No.1093 区間の和 / Sum of Range
ユーザー mkawa2mkawa2
提出日時 2021-06-10 16:29:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 1,023 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 20,328 KB
最終ジャッジ日時 2024-05-07 10:10:21
合計ジャッジ時間 8,704 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
10,752 KB
testcase_01 AC 156 ms
14,824 KB
testcase_02 AC 79 ms
12,032 KB
testcase_03 AC 131 ms
18,764 KB
testcase_04 AC 121 ms
19,880 KB
testcase_05 AC 191 ms
14,864 KB
testcase_06 AC 79 ms
14,032 KB
testcase_07 AC 132 ms
14,660 KB
testcase_08 AC 166 ms
20,028 KB
testcase_09 AC 160 ms
13,056 KB
testcase_10 AC 152 ms
17,796 KB
testcase_11 AC 183 ms
14,720 KB
testcase_12 AC 162 ms
17,032 KB
testcase_13 AC 34 ms
11,264 KB
testcase_14 AC 184 ms
14,008 KB
testcase_15 AC 91 ms
14,820 KB
testcase_16 AC 237 ms
16,940 KB
testcase_17 AC 169 ms
12,800 KB
testcase_18 AC 137 ms
13,568 KB
testcase_19 AC 48 ms
12,416 KB
testcase_20 AC 108 ms
12,160 KB
testcase_21 AC 208 ms
14,164 KB
testcase_22 AC 231 ms
17,204 KB
testcase_23 AC 140 ms
12,544 KB
testcase_24 AC 118 ms
19,260 KB
testcase_25 AC 181 ms
14,876 KB
testcase_26 AC 186 ms
17,316 KB
testcase_27 AC 194 ms
14,028 KB
testcase_28 AC 177 ms
17,648 KB
testcase_29 AC 286 ms
20,328 KB
testcase_30 AC 66 ms
12,672 KB
testcase_31 AC 93 ms
14,840 KB
testcase_32 AC 113 ms
15,736 KB
testcase_33 AC 236 ms
17,588 KB
testcase_34 AC 46 ms
11,776 KB
testcase_35 AC 187 ms
12,032 KB
testcase_36 AC 233 ms
19,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
dij = [(0, 1), (1, 0), (1, 1), (1, -1)]
inf = 10**16
md = 998244353
# md = 10**9+7

from collections import deque
from bisect import bisect

n, k = LI()
aa = LI()
q = deque()
s = 0
ss = []
for a in aa:
    q.append(a)
    s += a
    if len(q) > k: s -= q.popleft()
    if len(q) == k: ss.append(s)

ss.sort()
for _ in range(II()):
    print(bisect(ss, II()))
0