結果

問題 No.1093 区間の和 / Sum of Range
ユーザー 👑 KazunKazun
提出日時 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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,968 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 159 ms
87,368 KB
testcase_13 AC 59 ms
67,840 KB
testcase_14 AC 227 ms
79,536 KB
testcase_15 AC 103 ms
80,640 KB
testcase_16 AC 259 ms
85,376 KB
testcase_17 WA -
testcase_18 AC 178 ms
79,232 KB
testcase_19 AC 69 ms
70,656 KB
testcase_20 AC 151 ms
76,544 KB
testcase_21 AC 275 ms
79,560 KB
testcase_22 AC 247 ms
85,760 KB
testcase_23 AC 196 ms
77,136 KB
testcase_24 AC 95 ms
88,832 KB
testcase_25 WA -
testcase_26 AC 189 ms
88,320 KB
testcase_27 AC 241 ms
79,788 KB
testcase_28 AC 173 ms
87,680 KB
testcase_29 WA -
testcase_30 AC 91 ms
77,056 KB
testcase_31 AC 100 ms
81,408 KB
testcase_32 AC 123 ms
81,920 KB
testcase_33 AC 243 ms
87,296 KB
testcase_34 WA -
testcase_35 AC 250 ms
77,024 KB
testcase_36 AC 229 ms
92,032 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

    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