U645266 lyh 爱物理(physics)

题目背景

**最下面的下载附件有大数据样例。** lyh 爱物理程度 $2.147483647$(梅森素数,$2^{31} - 1$,也是 int 类型能存储的最大的数)。 PRE 杯(#2026.1.30 Lv.1)T3(CF2000)。

题目描述

题中所说的力不是指力学的力。 定义一个向左的力为 $\operatorname{L}$,向右的力为 $\operatorname{R}$。 这些力是平衡的: - $\operatorname{LR}$ - $\operatorname{L}A\operatorname{R}$($A$ 是平衡力) - $AB$($A,B$ 是平衡力) 那 lyh 就有想法了,他给出了三种操作: $1.\ L\ x_1 \ opt$,向右端施加 $x_1$ 个向左的力。 $2.\ R\ x_2 \ opt$,向右端施加 $x_2$ 个向右的力。 $3.\ D\ x_3 \ opt$,删除上 $x_3$ 个施加的力(保证不会有力的总数为负的情况)。 每个操作的 $opt \in \{0,1\}$,若 $opt = 1$ ,则需要执行操作后回答当前平衡力的不同组合数量(平衡力的组合不同,当且仅当力的数量或位置有不同)。 lyh 给了你 $n$ 个操作,依次按上述执行。

输入格式

第一行为 $n$。 后 $n$ 行如题输入操作。

输出格式

若干行,一行一个结果。

说明/提示

### 【样例解释】: | 操作序号 | 力示意图 | 对应输出 | | :---: | :---: | :---: | |$1$|$\operatorname{LLL}$| 0 | |$2$|$\operatorname{LLLRR}$| 2 | |$3$|$\operatorname{L}$| 0 | |$4$|$\operatorname{LRR}$| 1 | |$5$|$\operatorname{LRRL}$| 1 | |$6$|$\operatorname{LR}$| 1 | |$7$|$\operatorname{LRL}$| 1 | |$8$|$\operatorname{LRLR}$| 3 | |$9$|$\operatorname{LRLRL}$| 3 | |$10$|$\operatorname{LRLRLR}$| 6 | |$11$|$\operatorname{LRLR}$| 3 | |$12$|$\operatorname{LRLRLL}$| 3 | |$13$|$\operatorname{LRLRLLRR}$| 7 | |$14$|$\operatorname{LRLRLL}$| 3 | |$15$|$\operatorname{LRLRLLR}$| 4 | ### 【样例 2】 见下载文件下的 $\textbf{\textit{physics.zip/physics2.in}}$ 与 $\textbf{\textit{physics.zip/physics2.ans}}$ 该样例满足测试点 $1$ 的约束条件。 ### 【样例 3】 见下载文件下的 $\textbf{\textit{physics.zip/physics3.in}}$ 与 $\textbf{\textit{physics.zip/physics3.ans}}$ 该样例满足测试点 $14$ 的约束条件。 ### 【样例 4】 见下载文件下的 $\textbf{\textit{physics.zip/physics4.in}}$ 与 $\textbf{\textit{physics.zip/physics4.ans}}$ 该样例满足测试点 $15 \sim 17$ 的约束条件。 | 测试点 | $n$ | $x_1$ | $x_2$ | $x_3$ | | :---: | :---: |:---:| :---: | :---: | |$1$|$\le 100$|$\le 10$|$\le 10$|$\le 10$| |$2,3$|$\le 500$|$\le 100$|$\le 100$|$= 1$| |$4 \sim 6$|$\le 10^3$|$\le 100$|$\le 100$|$\le 3$| |$7 \sim 9$|$\le 10^3$|$\le 10^3$|$\le 10^3$|$\le 5$| |$10,11$|$\le 10^3$|$\le 10^5$|$\le 10^5$|$\le 10$| |$12,13$|$\le 10^3$|$\le 10^5$|$\le 10^5$|$= 0$| |$14$|$\le 10^4$|$= 1$|$= 1$|$= 1$| |$15 \sim 17$|$\le 10^4$|$\le 10 ^ 8$|$\le 10 ^ 8$|$\le 3$| |$18 \sim 20$|$\le 2 \times 10^5$|$\le 10 ^ 9$|$\le 10 ^ 9$|$\le 10$| 对于 $100\%$ 的数据,$1 \le n \le 2 \times 10 ^ 5$, $0 \le x_1,x_2 \le 10 ^ 9$, $0 \le x_3 \le 10$,保证存在 $opt = 1$。