CF1883D.In Love

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

  • ++ ll rr — Add the segment (l,r)(l, r) to the multiset,
  • - ll rr — Remove exactly one segment (l,r)(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)(l, r) and (a,b)(a, b) do not intersect if there does not exist a point xx such that lxrl \leq x \leq r and axba \leq x \leq b .

输入格式

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

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

输出格式

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.

输入输出样例

  • 输入#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

    输出#1

    NO
    YES
    YES
    YES
    YES
    YES
    NO
    NO
    YES
    NO
    NO
    NO

说明/提示

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

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

首页