結果
| 問題 |
No.1093 区間の和 / Sum of Range
|
| ユーザー |
norioc
|
| 提出日時 | 2025-02-17 04:53:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 298 ms / 2,000 ms |
| コード長 | 448 bytes |
| コンパイル時間 | 198 ms |
| コンパイル使用メモリ | 81,796 KB |
| 実行使用メモリ | 102,132 KB |
| 最終ジャッジ日時 | 2025-02-17 04:54:01 |
| 合計ジャッジ時間 | 10,101 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 36 |
ソースコード
from itertools import accumulate
from bisect import bisect_right
def accum(a: list):
acc = list(accumulate(a))
return lambda l, r: acc[r] - (acc[l-1] if l > 0 else 0)
N, K = map(int, input().split())
A = list(map(int, input().split()))
acc = accum(A)
ss = []
for i in range(K-1, N):
s = acc(i-K+1, i)
ss.append(s)
ss.sort()
Q = int(input())
for _ in range(Q):
x = int(input())
ans = bisect_right(ss, x)
print(ans)
norioc