結果
| 問題 | No.1000 Point Add and Array Add |
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2024-12-21 15:20:11 |
| 言語 | PyPy3 (8.0.1 + ACL) |
| 結果 |
TLE
不安定
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 824 bytes |
| 記録 | |
| コンパイル時間 | 81 ms |
| コンパイル使用メモリ | 64,292 KB |
| 実行使用メモリ | 307,108 KB |
| 最終ジャッジ日時 | 2026-11-06 14:48:41 |
| 合計ジャッジ時間 | 18,781 ms |
|
ジャッジサーバーID (参考情報) |
judge7_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 21 TLE * 2 |
ソースコード
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)
ntuda