結果
問題 | No.1093 区間の和 / Sum of Range |
ユーザー | McGregorsh |
提出日時 | 2022-07-09 08:34:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 523 ms / 2,000 ms |
コード長 | 1,628 bytes |
コンパイル時間 | 1,117 ms |
コンパイル使用メモリ | 86,704 KB |
実行使用メモリ | 122,348 KB |
最終ジャッジ日時 | 2023-08-28 18:48:36 |
合計ジャッジ時間 | 17,703 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 226 ms
92,768 KB |
testcase_01 | AC | 398 ms
103,524 KB |
testcase_02 | AC | 327 ms
96,844 KB |
testcase_03 | AC | 313 ms
118,448 KB |
testcase_04 | AC | 261 ms
114,968 KB |
testcase_05 | AC | 459 ms
102,080 KB |
testcase_06 | AC | 307 ms
100,484 KB |
testcase_07 | AC | 378 ms
101,744 KB |
testcase_08 | AC | 363 ms
119,416 KB |
testcase_09 | AC | 438 ms
98,480 KB |
testcase_10 | AC | 368 ms
111,568 KB |
testcase_11 | AC | 432 ms
103,700 KB |
testcase_12 | AC | 377 ms
111,220 KB |
testcase_13 | AC | 239 ms
93,488 KB |
testcase_14 | AC | 465 ms
100,236 KB |
testcase_15 | AC | 328 ms
102,352 KB |
testcase_16 | AC | 491 ms
109,368 KB |
testcase_17 | AC | 442 ms
97,236 KB |
testcase_18 | AC | 390 ms
100,484 KB |
testcase_19 | AC | 279 ms
96,248 KB |
testcase_20 | AC | 368 ms
96,628 KB |
testcase_21 | AC | 491 ms
100,580 KB |
testcase_22 | AC | 485 ms
109,692 KB |
testcase_23 | AC | 419 ms
96,636 KB |
testcase_24 | AC | 308 ms
113,656 KB |
testcase_25 | AC | 439 ms
102,860 KB |
testcase_26 | AC | 399 ms
112,504 KB |
testcase_27 | AC | 459 ms
100,436 KB |
testcase_28 | AC | 394 ms
111,712 KB |
testcase_29 | AC | 523 ms
122,348 KB |
testcase_30 | AC | 295 ms
96,664 KB |
testcase_31 | AC | 311 ms
103,084 KB |
testcase_32 | AC | 334 ms
104,580 KB |
testcase_33 | AC | 478 ms
111,284 KB |
testcase_34 | AC | 279 ms
97,000 KB |
testcase_35 | AC | 464 ms
96,940 KB |
testcase_36 | AC | 446 ms
117,264 KB |
ソースコード
import sys, re from math import ceil, floor, sqrt, pi, factorial, gcd from copy import deepcopy from collections import Counter, deque, defaultdict from heapq import heapify, heappop, heappush from itertools import accumulate, product, combinations, combinations_with_replacement, permutations from bisect import bisect, bisect_left, bisect_right from functools import reduce from decimal import Decimal, getcontext def i_input(): return int(input()) def i_map(): return map(int, input().split()) def i_list(): return list(i_map()) def i_row(N): return [i_input() for _ in range(N)] def i_row_list(N): return [i_list() for _ in range(N)] def s_input(): return input() def s_map(): return input().split() def s_list(): return list(s_map()) def s_row(N): return [s_input for _ in range(N)] def s_row_str(N): return [s_list() for _ in range(N)] def s_row_list(N): return [list(s_input()) for _ in range(N)] def lcm(a, b): return a * b // gcd(a, b) def get_distance(x1, y1, x2, y2): d = sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) return d def rotate(table): n_fild = [] for x in zip(*table[::-1]): n_fild.append(x) return n_fild sys.setrecursionlimit(10 ** 7) INF = float('inf') MOD = 10 ** 9 + 7 MOD2 = 998244353 ###関数コピーしたか?### def main(): n, k = i_map() A = i_list() accumu_a = [0] + list(accumulate(A)) new_a = [] for i in range(n-k+1): new_a.append(accumu_a[i+k] - accumu_a[i]) new_a.sort() q = int(input()) for i in range(q): num = int(input()) print(bisect_right(new_a, num)) if __name__ == '__main__': main()