結果
| 問題 | 
                            No.1093 区間の和 / Sum of Range
                             | 
                    
| ユーザー | 
                             | 
                    
| 提出日時 | 2021-12-25 10:23:09 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 567 bytes | 
| コンパイル時間 | 341 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 20,580 KB | 
| 最終ジャッジ日時 | 2024-09-21 12:05:28 | 
| 合計ジャッジ時間 | 23,047 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | WA * 1 | 
| other | AC * 7 WA * 29 | 
ソースコード
N,K = map(int,input().split())
a = list(map(int,input().split()))
S = []
ans = 0
for i in range(K):
    ans += a[i]
S.append(ans)
j = 1
while j + K -1 < N:
    ans = S[-1] + a[j+K-1] - a[j]
    S.append(ans)
    j += 1
S.sort()
Q = int(input())
for _ in range(Q):
    x = int(input())
    if S[-1] <= x:
        print(len(S))
    else:
        end = len(S) - 1
        start = -1
        while end - start > 1:
            mid = (start + end) // 2
            if S[mid] > x:
                end = mid
            else:
                start = mid
        print(end)