結果

問題 No.1093 区間の和 / Sum of Range
ユーザー first_vilfirst_vil
提出日時 2020-06-25 10:28:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,038 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 523 ms
コンパイル使用メモリ 10,688 KB
実行使用メモリ 19,760 KB
最終ジャッジ日時 2023-09-16 21:51:19
合計ジャッジ時間 19,917 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,860 KB
testcase_01 AC 488 ms
12,908 KB
testcase_02 AC 222 ms
9,500 KB
testcase_03 AC 89 ms
17,704 KB
testcase_04 AC 71 ms
19,256 KB
testcase_05 AC 730 ms
12,596 KB
testcase_06 AC 142 ms
11,672 KB
testcase_07 AC 381 ms
12,764 KB
testcase_08 AC 294 ms
19,048 KB
testcase_09 AC 608 ms
10,660 KB
testcase_10 AC 339 ms
16,056 KB
testcase_11 AC 668 ms
12,996 KB
testcase_12 AC 403 ms
15,468 KB
testcase_13 AC 17 ms
8,532 KB
testcase_14 AC 829 ms
11,648 KB
testcase_15 AC 165 ms
12,764 KB
testcase_16 AC 924 ms
15,376 KB
testcase_17 AC 711 ms
10,320 KB
testcase_18 AC 516 ms
11,556 KB
testcase_19 AC 49 ms
9,768 KB
testcase_20 AC 391 ms
9,748 KB
testcase_21 AC 840 ms
12,112 KB
testcase_22 AC 830 ms
15,668 KB
testcase_23 AC 560 ms
10,012 KB
testcase_24 AC 114 ms
18,960 KB
testcase_25 AC 637 ms
12,972 KB
testcase_26 AC 514 ms
15,516 KB
testcase_27 AC 803 ms
11,704 KB
testcase_28 AC 477 ms
16,168 KB
testcase_29 AC 1,038 ms
19,760 KB
testcase_30 AC 123 ms
10,072 KB
testcase_31 AC 157 ms
12,844 KB
testcase_32 AC 251 ms
13,420 KB
testcase_33 AC 843 ms
15,824 KB
testcase_34 AC 55 ms
9,028 KB
testcase_35 AC 849 ms
9,388 KB
testcase_36 AC 692 ms
18,500 KB
権限があれば一括ダウンロードができます

ソースコード

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