結果

問題 No.1093 区間の和 / Sum of Range
ユーザー first_vil
提出日時 2020-06-25 10:28:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 1,288 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 20,852 KB
最終ジャッジ日時 2024-07-03 20:50:34
合計ジャッジ時間 23,915 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k=map(int,input().split())
a=[0]+list(map(int,input().split()))
for i in range(n):
    a[i+1]+=a[i]
s=sorted([a[i+k]-a[i] for i in range(n-k+1)])

q=int(input())
for i in range(q):
    x=int(input())
    l=-1;r=n-k+1
    while r-l>1:
        mid=l+r>>1
        if s[mid]<=x:
            l=mid
        else:
            r=mid
    print(r)
0