結果

問題 No.1890 Many Sequences Sum Queries
ユーザー titia
提出日時 2022-04-05 00:20:37
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 681 ms / 2,000 ms
コード長 314 bytes
コンパイル時間 241 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 19,452 KB
最終ジャッジ日時 2024-11-25 19:09:39
合計ジャッジ時間 6,676 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N,Q=map(int,input().split())
A=list(map(int,input().split()))

P=[]
for a in A:
    P+=list(range(1,a+1))

S=[0]
for p in P:
    S.append(S[-1]+p)

for i in range(Q):
    x=int(input())
    k=bisect.bisect_left(S,x)

    if k==len(S):
        print(-1)
    else:
        print(k)
0