結果

問題 No.1093 区間の和 / Sum of Range
ユーザー 👑 Kazun
提出日時 2020-06-26 00:09:06
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 82,284 KB
実行使用メモリ 97,320 KB
最終ジャッジ日時 2024-07-03 22:01:47
合計ジャッジ時間 8,634 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 21 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K=map(int,input().split())
A=list(map(int,input().split()))

S=sum(A[:K])
T=[S]
for i in range(N-K):
    S+=A[K+i]-A[i]
    T.append(S)
T.sort()

Q=int(input())
for _ in range(Q):
    B=int(input())

    if B>=T[-1]:
        print(N-K+1)
        continue

    L,R=0,N-K
    while R-L>1:
        C=(L+R)//2
        if T[C]>B:
            R=C
        else:
            L=C
    print(R)
0