ABC278 - D - All Assign Point Add
問題
$ 1のクエリで$ Aは一様になるので、わざわざすべて更新せずに変数で持てばよい。
$ 2のクエリの更新は別で持っておいて、$ 1のクエリでリセットする。リストで管理するとリセットするときに構築$ O(N)で結局遅いので、連想配列(dict)で管理する。 code: d.py
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
D = defaultdict(int)
base = -1
ans = []
for _ in range(Q):
p, *q = map(int, input().split())
if p == 1:
D = defaultdict(int)
elif p == 2:
i, x = q
else:
if base < 0:
else:
y = base
print(*ans, sep="\n")