CF1641C.Anonymity Is Important

提高+/省选-

通过率:0%

时间限制:1.50s

内存限制:256MB

AC君温馨提醒

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

题目描述

In the work of a doctor, it is important to maintain the anonymity of clients and the results of tests. The test results are sent to everyone personally by email, but people are very impatient and they want to know the results right away.

That's why in the testing lab "De-vitro" doctors came up with an experimental way to report the results. Let's assume that nn people took the tests in the order of the queue. Then the chief doctor Sam can make several statements, in each telling if there is a sick person among the people in the queue from ll-th to rr-th (inclusive), for some values ll and rr.

During the process, Sam will check how well this scheme works and will be interested in whether it is possible to find out the test result of ii-th person from the information he announced. And if it can be done, then is that patient sick or not.

Help Sam to test his scheme.

在医生的工作中,保护患者隐私及检测结果的匿名性至关重要。检测结果会通过电子邮件单独发送给每位患者,但人们往往非常急切,希望立刻获知自己的检测结果。

因此,在“体外”(De-vitro)检测实验室中,医生们提出了一种实验性的结果通报方案。假设共有 nn 人按排队顺序接受了检测。那么,首席医生 Sam 可以发布若干条声明;每条声明针对某个区间 [l,r][l, r](即队列中从第 ll 位到第 rr 位,含端点),说明该区间内是否存在患病者。

在整个过程中,Sam 将评估该方案的有效性,并特别关注:根据他所发布的全部信息,是否能唯一确定第 ii 位患者的检测结果?若可以确定,则该患者究竟是否患病?

请协助 Sam 测试这一方案。

输入格式

The first line contains two integers nn, qq (1≤n,q≤2⋅1051 \le n, q \le 2 \cdot 10^5) — the number of people and the number of queries.

In each of the next qq lines, the description of the query is given. The first number in the line is tt (t=0t = 0 or t=1t = 1) — the type of the query.

If t=0t = 0, the line contains three more integers l,r,xl, r, x (1≤l≤r≤n1 \le l \le r \le n, x=0x = 0 or x=1x = 1). This query means that Sam tells that among the people in the queue from ll-th to rr-th (inclusive):

  • there was at least one sick person, if x=1x=1,
  • there is no sick people, if x=0x=0.

If t=1t = 1, the line contains one more integer jj (1≤j≤n1 \le j \le n) — the position of the patient in the queue, for which Sam wants to know the status.

All queries are correct, that means that there always exists an example of the queue of length nn for which all reported results (statements from queries with t=0t = 0) are true.

第一行包含两个整数 nn、qq(1≤n,q≤2⋅1051 \le n, q \le 2 \cdot 10^5)—— 分别表示人数和查询次数。

接下来的 qq 行中,每行描述一个查询。每行的第一个数为 tt(t=0t = 0 或 t=1t = 1)—— 表示查询类型。

若 t=0t = 0,则该行还包含三个整数 ll、rr、xx(1≤l≤r≤n1 \le l \le r \le n,x=0x = 0 或 x=1x = 1)。该查询表示 Sam 声称:在队列中从第 ll 个人到第 rr 个人(含端点)这一区间内:

  • 若 x=1x = 1,则至少存在一名生病的人;
  • 若 x=0x = 0,则不存在任何生病的人。

若 t=1t = 1,则该行还包含一个整数 jj(1≤j≤n1 \le j \le n)—— 表示 Sam 想要知道队列中第 jj 个位置上的人的健康状态。

所有查询均合法,即:总存在一个长度为 nn 的队列,使得所有 t=0t = 0 的查询所陈述的结果均为真。

输出格式

After each Sam question (query with t=1t = 1) print:

  • "NO", if the patient is definitely not sick,
  • "YES", if the patient is definitely sick.
  • "N/A", if it is impossible to definitely identify the status of patient having the given information.

每次处理山姆的提问(即 t=1t = 1 的查询)后,输出:

  • “NO”,表示该病人确定未患病;
  • “YES”,表示该病人确定已患病;
  • “N/A”,表示根据所给信息无法确定该病人的患病状态。

输入输出样例

  • 输入#1

    6 9
    0 4 5 0
    1 5
    1 6
    0 4 6 1
    1 6
    0 2 5 1
    0 2 2 0
    1 3
    1 2

    输出#1

    NO
    N/A
    YES
    YES
    NO

说明/提示

In the first test for the five first queries:

  1. Initially Sam tells that people 44, 55 are not sick.
  2. In the next query Sam asks the status of the patient 55. From the previous query, we know that the patient is definitely not sick.
  3. In the next query Sam asks the status of the patient 66. We don't know any information about that patient now.
  4. After that Sam tells that there exists a sick patient among 44, 55, 66.
  5. In the next query Sam asks the status of the patient 66. Now we can tell that this patient is definitely sick.

在第一个测试用例的前五个查询中:

  1. 最初,Sam 告知患者 44、55 不患病。
  2. 在下一个查询中,Sam 询问患者 55 的状态。根据上一个查询,我们已知该患者一定不患病。
  3. 在下一个查询中,Sam 询问患者 66 的状态。此时我们对该患者没有任何信息。
  4. 随后,Sam 告知患者 44、55、66 中存在至少一名患病者。
  5. 在下一个查询中,Sam 询问患者 66 的状态。此时我们可以确定该患者一定患病。

输入解题思路,AI测评打分。不知道怎么写?

首页