結果

問題 No.1890 Many Sequences Sum Queries
ユーザー DrDrpilot
提出日時 2022-05-02 12:46:01
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-01 15:25:55
合計ジャッジ時間 6,384 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
n,q=map(int,input().split())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    for j in a[:i+1]:
        b.append(j)
b=list(accumulate(b))
m=len(b)
import bisect
for _ in range(q):
    s=int(input())
    num=bisect.bisect_right(b,s)
    if num>=m:
        print(-1)
    else:
        print(num)
0