結果
| 問題 | No.1890 Many Sequences Sum Queries |
| ユーザー |
ripity
|
| 提出日時 | 2022-04-04 15:18:05 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 487 bytes |
| 記録 | |
| コンパイル時間 | 65 ms |
| コンパイル使用メモリ | 14,976 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2026-09-29 17:48:24 |
| 合計ジャッジ時間 | 11,159 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | TLE * 1 -- * 24 |
ソースコード
N,Q = map(int,input().split())
a = list(map(int,input().split()))
c = []
for i in range(N):
c.append(a[i]*(a[i]+1)//2)
for _ in range(Q):
s = int(input())
sum_b = 0
ANS = 0
for i in range(N):
if sum_b+c[i] < s:
sum_b += c[i]
ANS += a[i]
elif sum_b < s:
for j in range(a[i]):
ANS += 1
sum_b += j+1
if sum_b >= s: break
if sum_b < s: print(-1)
else: print(ANS)
ripity