PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#DSU0000089. Giữ bí mật kết quả xét nghiệm (Anonymity Is Important)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Giữ bí mật kết quả xét nghiệm (Anonymity Is Important)

Anonymity Is Important

Source: Codeforces

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn people numbered 11 through nn. Every person is either sick or healthy, but their statuses are initially unknown.

Process qq operations in order:

  • 0 l r x: publish a statement about positions ll through rr. If x=0x=0, everyone in the interval is healthy. If x=1x=1, at least one person in the interval is sick.
  • 1 j: ask whether the status of person jj is uniquely determined by all statements published so far.

All published statements are true and mutually consistent: at least one assignment of statuses always satisfies them. Statements are never withdrawn. Each query must consider all assignments consistent with the available information, not an arbitrary assignment.

Input

The first line contains n,qn,q. Each of the next qq lines is either 0 l r x or 1 j.

Output

For each 1 j query, print NO if definitely healthy, YES if definitely sick, or N/A otherwise.

Subtasks

  • Subtask 1 (20 points): 1≤n≤161\le n\le 16, 1≤q≤501\le q\le 50, t∈{0,1}t\in\{0,1\}, 1≤l≤r≤n1\le l\le r\le n, x∈{0,1}x\in\{0,1\}, 1≤j≤n1\le j\le n; mọi thông báo nhất quán.
  • Subtask 2 (30 points): 1≤n≤30001\le n\le 3000, 1≤q≤80001\le q\le 8000, t∈{0,1}t\in\{0,1\}, 1≤l≤r≤n1\le l\le r\le n, x∈{0,1}x\in\{0,1\}, 1≤j≤n1\le j\le n; mọi thông báo nhất quán.
  • Subtask 3 (50 points): 1≤n,q≤2⋅1051\le n,q\le 2\cdot10^5, t∈{0,1}t\in\{0,1\}, 1≤l≤r≤n1\le l\le r\le n, x∈{0,1}x\in\{0,1\}, 1≤j≤n1\le j\le n; mọi thông báo nhất quán.

Example

Input

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

Output

NO
N/A
YES
YES
NO

Explanation

The first statement makes person 55 definitely healthy, while person 66 is unknown. After the interval [4,6][4,6] is announced to contain a sick person, person 66 must be sick.