結果
問題 |
No.1000 Point Add and Array Add
|
ユーザー |
![]() |
提出日時 | 2024-12-21 15:20:11 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 824 bytes |
コンパイル時間 | 181 ms |
コンパイル使用メモリ | 82,788 KB |
実行使用メモリ | 145,856 KB |
最終ジャッジ日時 | 2024-12-21 15:20:18 |
合計ジャッジ時間 | 5,563 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 2 |
other | RE * 22 |
ソースコード
from itertools import accumulate N,Q = map(int,input().split()) A = list(map(int,input().split())) CXY = [input().split() for _ in range(Q)] B = [0] * N C = [0] * (N + 1) for c,x,y in CXY: if c == "B": x, y = int(x), int(y) C[x - 1] += 1 C[y] -= 1 C = list(accumulate(C)) from atcoder.lazysegtree import LazySegTree def op(x, y): return [x[0] + y[0], x[1] + y[1]] e = [0, 0] def mapping(f, x): return [x[0] + f * x[1], x[1]] def composition(g, f): return g + f id = 0 base = [[0, 1] for _ in range(N)] LST = LazySegTree(op, e, mapping, composition, id, base) for c,x,y in CXY: x, y = int(x), int(y) if c == "B": LST.apply(x-1,y,1) else: B[x-1] += y * (C[x-1] - LST.get(x-1)[0]) for i in range(N): B[i] += A[i] * LST.get(i)[0] print(*B)