結果

問題 No.1093 区間の和 / Sum of Range
ユーザー 330Xs330Xs
提出日時 2022-02-05 15:02:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 356 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,248 KB
実行使用メモリ 96,852 KB
最終ジャッジ日時 2023-09-02 06:43:07
合計ジャッジ時間 11,214 ms
ジャッジサーバーID
(参考情報)
judge16 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,260 KB
testcase_01 AC 237 ms
83,348 KB
testcase_02 AC 178 ms
78,404 KB
testcase_03 AC 155 ms
93,584 KB
testcase_04 AC 106 ms
92,084 KB
testcase_05 AC 304 ms
82,236 KB
testcase_06 AC 150 ms
81,192 KB
testcase_07 AC 215 ms
82,180 KB
testcase_08 AC 198 ms
94,096 KB
testcase_09 AC 278 ms
79,008 KB
testcase_10 AC 205 ms
88,432 KB
testcase_11 AC 272 ms
83,792 KB
testcase_12 AC 207 ms
88,332 KB
testcase_13 AC 84 ms
76,168 KB
testcase_14 AC 298 ms
81,052 KB
testcase_15 AC 153 ms
82,108 KB
testcase_16 AC 330 ms
86,596 KB
testcase_17 AC 280 ms
78,528 KB
testcase_18 AC 224 ms
81,248 KB
testcase_19 AC 124 ms
78,128 KB
testcase_20 AC 206 ms
77,976 KB
testcase_21 AC 323 ms
81,244 KB
testcase_22 AC 327 ms
86,620 KB
testcase_23 AC 261 ms
78,124 KB
testcase_24 AC 146 ms
89,500 KB
testcase_25 AC 285 ms
82,784 KB
testcase_26 AC 245 ms
89,636 KB
testcase_27 AC 294 ms
81,152 KB
testcase_28 AC 233 ms
88,508 KB
testcase_29 AC 356 ms
96,852 KB
testcase_30 AC 139 ms
78,364 KB
testcase_31 AC 151 ms
83,200 KB
testcase_32 AC 177 ms
83,548 KB
testcase_33 AC 313 ms
87,760 KB
testcase_34 AC 122 ms
78,288 KB
testcase_35 AC 309 ms
78,596 KB
testcase_36 AC 286 ms
92,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right
n,k = map(int,input().split())
a = list(map(int,input().split()))
aa = a[:k]
aa_sum = sum(aa)

s = []
s.append(aa_sum)
for i in range(n-k):
    s.append(aa_sum - a[i] + a[k+i])
    aa_sum = aa_sum - a[i] + a[k+i]

s.sort()
q = int(input())    
for _ in range(q):
    m = int(input())
    print(bisect_right(s,m))
0