A14950 | Anonymity Is Important
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $n$ 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 $l$ -th to $r$ -th (inclusive), for some values $l$ and $r$ .
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 $i$ -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.
That's why in the testing lab "De-vitro" doctors came up with an experimental way to report the results. Let's assume that $n$ 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 $l$ -th to $r$ -th (inclusive), for some values $l$ and $r$ .
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 $i$ -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.
输入格式
The first line contains two integers $n$ , $q$ ( $1 \le n, q \le 2 \cdot 10^5$ ) — the number of people and the number of queries.
In each of the next $q$ lines, the description of the query is given. The first number in the line is $t$ ( $t = 0$ or $t = 1$ ) — the type of the query.
If $t = 0$ , the line contains three more integers $l, r, x$ ( $1 \le l \le r \le n$ , $x = 0$ or $x = 1$ ). This query means that Sam tells that among the people in the queue from $l$ -th to $r$ -th (inclusive):
- there was at least one sick person, if $x=1$ ,
- there is no sick people, if $x=0$ .
If $t = 1$ , the line contains one more integer $j$ ( $1 \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 $n$ for which all reported results (statements from queries with $t = 0$ ) are true.
In each of the next $q$ lines, the description of the query is given. The first number in the line is $t$ ( $t = 0$ or $t = 1$ ) — the type of the query.
If $t = 0$ , the line contains three more integers $l, r, x$ ( $1 \le l \le r \le n$ , $x = 0$ or $x = 1$ ). This query means that Sam tells that among the people in the queue from $l$ -th to $r$ -th (inclusive):
- there was at least one sick person, if $x=1$ ,
- there is no sick people, if $x=0$ .
If $t = 1$ , the line contains one more integer $j$ ( $1 \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 $n$ for which all reported results (statements from queries with $t = 0$ ) are true.
输出格式
After each Sam question (query with $t = 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.
- "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.
输入输出样例
输入 #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 $4$ , $5$ are not sick.
2. In the next query Sam asks the status of the patient $5$ . 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 $6$ . We don't know any information about that patient now.
4. After that Sam tells that there exists a sick patient among $4$ , $5$ , $6$ .
5. In the next query Sam asks the status of the patient $6$ . Now we can tell that this patient is definitely sick.
1. Initially Sam tells that people $4$ , $5$ are not sick.
2. In the next query Sam asks the status of the patient $5$ . 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 $6$ . We don't know any information about that patient now.
4. After that Sam tells that there exists a sick patient among $4$ , $5$ , $6$ .
5. In the next query Sam asks the status of the patient $6$ . Now we can tell that this patient is definitely sick.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted