結果

問題 No.1093 区間の和 / Sum of Range
ユーザー 👑 KazunKazun
提出日時 2020-06-26 00:10:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 306 ms / 2,000 ms
コード長 437 bytes
コンパイル時間 261 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 97,236 KB
最終ジャッジ日時 2023-09-16 23:20:29
合計ジャッジ時間 9,671 ms
ジャッジサーバーID
(参考情報)
judge12 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,608 KB
testcase_01 AC 230 ms
83,504 KB
testcase_02 AC 175 ms
79,016 KB
testcase_03 AC 133 ms
94,248 KB
testcase_04 AC 91 ms
92,240 KB
testcase_05 AC 252 ms
82,472 KB
testcase_06 AC 127 ms
81,268 KB
testcase_07 AC 180 ms
82,104 KB
testcase_08 AC 172 ms
94,072 KB
testcase_09 AC 249 ms
80,128 KB
testcase_10 AC 171 ms
88,176 KB
testcase_11 AC 232 ms
83,568 KB
testcase_12 AC 166 ms
88,340 KB
testcase_13 AC 86 ms
77,160 KB
testcase_14 AC 251 ms
80,404 KB
testcase_15 AC 123 ms
81,836 KB
testcase_16 AC 282 ms
87,360 KB
testcase_17 AC 248 ms
78,732 KB
testcase_18 AC 189 ms
80,660 KB
testcase_19 AC 93 ms
76,800 KB
testcase_20 AC 169 ms
77,760 KB
testcase_21 AC 270 ms
81,068 KB
testcase_22 AC 270 ms
88,096 KB
testcase_23 AC 215 ms
77,620 KB
testcase_24 AC 116 ms
90,076 KB
testcase_25 AC 255 ms
83,168 KB
testcase_26 AC 207 ms
90,572 KB
testcase_27 AC 260 ms
81,144 KB
testcase_28 AC 193 ms
89,564 KB
testcase_29 AC 306 ms
97,236 KB
testcase_30 AC 113 ms
78,224 KB
testcase_31 AC 123 ms
82,924 KB
testcase_32 AC 142 ms
83,580 KB
testcase_33 AC 269 ms
88,672 KB
testcase_34 AC 109 ms
78,492 KB
testcase_35 AC 267 ms
78,496 KB
testcase_36 AC 234 ms
93,548 KB
権限があれば一括ダウンロードができます

ソースコード

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
    elif B<T[0]:
        print(0)
        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