Codeforces Round 905 (Div. 3)
D
In Love
Codeforces
1500
原题
← CE →
翻译中…

Initially, you have an empty multiset of segments. You need to process $q$ operations of two types:

翻译中…
  • $+$ $l$ $r$ — Add the segment $(l, r)$ to the multiset,
  • $-$ $l$ $r$ — Remove exactly one segment $(l, r)$ from the multiset. It is guaranteed that this segment exists in the multiset.
翻译中…

After each operation, you need to determine if there exists a pair of segments in the multiset that do not intersect. A pair of segments $(l, r)$ and $(a, b)$ do not intersect if there does not exist a point $x$ such that $l \leq x \leq r$ and $a \leq x \leq b$.

翻译中…

Input

翻译中…

The first line of each test case contains an integer $q$ ($1 \leq q \leq 10^5$) — the number of operations.

翻译中…

The next $q$ lines describe two types of operations. If it is an addition operation, it is given in the format $+$ $l$ $r$. If it is a deletion operation, it is given in the format $-$ $l$ $r$ ($1 \leq l \leq r \leq 10^9$).

翻译中…

Output

翻译中…

After each operation, print "YES" if there exists a pair of segments in the multiset that do not intersect, and "NO" otherwise.

翻译中…

You can print the answer in any case (uppercase or lowercase). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive answers.

翻译中…

Note

翻译中…

In the example, after the second, third, fourth, and fifth operations, there exists a pair of segments $(1, 2)$ and $(3, 4)$ that do not intersect.

翻译中…

Then we remove exactly one segment $(3, 4)$, and by that time we had two segments. Therefore, the answer after this operation also exists.

翻译中…

样例

Input #1
12
+ 1 2
+ 3 4
+ 2 3
+ 2 2
+ 3 4
- 3 4
- 3 4
- 1 2
+ 3 4
- 2 2
- 2 3
- 3 4
Output #1
NO
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
InputCopy OutputCopy
题目信息
题号
1883D
时间限制
2 s
内存限制
256 MB
标签
数据结构
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。