結果

問題 No.1093 区間の和 / Sum of Range
ユーザー tonnnura172tonnnura172
提出日時 2020-06-24 04:25:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 253 ms / 2,000 ms
コード長 1,020 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 22,624 KB
最終ジャッジ日時 2023-09-16 20:41:51
合計ジャッジ時間 7,083 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
9,404 KB
testcase_01 AC 134 ms
14,900 KB
testcase_02 AC 68 ms
11,632 KB
testcase_03 AC 108 ms
19,344 KB
testcase_04 AC 81 ms
21,000 KB
testcase_05 AC 175 ms
15,868 KB
testcase_06 AC 64 ms
13,464 KB
testcase_07 AC 110 ms
14,328 KB
testcase_08 AC 129 ms
20,492 KB
testcase_09 AC 138 ms
14,464 KB
testcase_10 AC 125 ms
17,548 KB
testcase_11 AC 166 ms
15,564 KB
testcase_12 AC 145 ms
16,640 KB
testcase_13 AC 31 ms
9,840 KB
testcase_14 AC 170 ms
16,968 KB
testcase_15 AC 75 ms
13,908 KB
testcase_16 AC 208 ms
19,692 KB
testcase_17 AC 152 ms
14,376 KB
testcase_18 AC 125 ms
14,756 KB
testcase_19 AC 41 ms
11,204 KB
testcase_20 AC 99 ms
13,092 KB
testcase_21 AC 186 ms
17,564 KB
testcase_22 AC 205 ms
19,336 KB
testcase_23 AC 131 ms
13,376 KB
testcase_24 AC 78 ms
19,808 KB
testcase_25 AC 155 ms
15,804 KB
testcase_26 AC 165 ms
17,716 KB
testcase_27 AC 173 ms
17,096 KB
testcase_28 AC 157 ms
17,384 KB
testcase_29 AC 253 ms
22,624 KB
testcase_30 AC 57 ms
12,140 KB
testcase_31 AC 84 ms
13,712 KB
testcase_32 AC 97 ms
15,008 KB
testcase_33 AC 203 ms
19,236 KB
testcase_34 AC 41 ms
10,460 KB
testcase_35 AC 171 ms
16,336 KB
testcase_36 AC 200 ms
19,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd, log2
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul, add
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce, lru_cache
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
a = LIST()
tmp = sum(a[:K])
S = [0]*(N-K+1)
for i in range(N-K+1):
    S[i] = tmp
    tmp -= a[i]
    if i+K < N:
        tmp += a[i+K]

S.sort()

Q = INT()
ans = [0]*Q

for i in range(Q):
    x = INT()
    ans[i] = bisect(S, x)

print(*ans, sep="\n")
0