結果

問題 No.1093 区間の和 / Sum of Range
ユーザー flippergo
提出日時 2024-12-09 08:58:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 331 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 96,512 KB
最終ジャッジ日時 2024-12-09 08:59:08
合計ジャッジ時間 10,594 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right
N,K = map(int,input().split())
A = list(map(int,input().split()))
S = []
cnt = sum(A[:K])
S.append(cnt)
for i in range(1,N-K+1):
    cnt = cnt-A[i-1]+A[i+K-1]
    S.append(cnt)
S = sorted(S)
Q = int(input())
for _ in range(Q):
    x = int(input())
    print(bisect_right(S,x))
0