結果
| 問題 |
No.1890 Many Sequences Sum Queries
|
| ユーザー |
rlangevin
|
| 提出日時 | 2023-01-11 20:16:06 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 366 bytes |
| コンパイル時間 | 233 ms |
| コンパイル使用メモリ | 82,076 KB |
| 実行使用メモリ | 82,900 KB |
| 最終ジャッジ日時 | 2024-12-22 13:59:04 |
| 合計ジャッジ時間 | 4,711 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 25 |
ソースコード
from bisect import *
N, Q = map(int, input().split())
A = list(map(int, input().split()))
L = []
for a in A:
L.extend(list(range(1, a + 1)))
M = len(L)
Ac = [0] * (M + 1)
for i in range(M):
Ac[i + 1] = Ac[i] + L[i]
for i in range(Q):
s = int(input())
ind = bisect_right(Ac, s)
if ind == M + 1:
print(-1)
else:
print(ind - 1)
rlangevin