Codeforces Round 439 (Div. 2)
E
The Untended Antiquity
Codeforces
2400
原题
← D→
翻译中…

Adieu l'ami.

翻译中…

Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence.

翻译中…

The space is represented by a rectangular grid of $*n* × *m*$ cells, arranged into $*n*$ rows and $*m*$ columns. The $*c*$-th cell in the $*r*$-th row is denoted by $(*r*, *c*)$.

翻译中…

Oshino places and removes barriers around rectangular areas of cells. Specifically, an action denoted by "$1 *r*_{1} *c*_{1} *r*_{2} *c*_{2}$" means Oshino's placing barriers around a rectangle with two corners being $(*r*_{1}, *c*_{1})$ and $(*r*_{2}, *c*_{2})$ and sides parallel to squares sides. Similarly, "$2 *r*_{1} *c*_{1} *r*_{2} *c*_{2}$" means Oshino's removing barriers around the rectangle. Oshino ensures that no barriers staying on the ground share any common points, nor do they intersect with boundaries of the $*n* × *m*$ area.

翻译中…

Sometimes Koyomi tries to walk from one cell to another carefully without striding over barriers, in order to avoid damaging various items on the ground. "$3 *r*_{1} *c*_{1} *r*_{2} *c*_{2}$" means that Koyomi tries to walk from $(*r*_{1}, *c*_{1})$ to $(*r*_{2}, *c*_{2})$ without crossing barriers.

翻译中…

And you're here to tell Koyomi the feasibility of each of his attempts.

翻译中…

Input

翻译中…

The first line of input contains three space-separated integers $*n*$, $*m*$ and $*q*$ ($1 ≤ *n*, *m* ≤ 2 500$, $1 ≤ *q* ≤ 100 000$) — the number of rows and columns in the grid, and the total number of Oshino and Koyomi's actions, respectively.

翻译中…

The following $*q*$ lines each describes an action, containing five space-separated integers $*t*$, $*r*_{1}$, $*c*_{1}$, $*r*_{2}$, $*c*_{2}$ ($1 ≤ *t* ≤ 3$, $1 ≤ *r*_{1}, *r*_{2} ≤ *n*$, $1 ≤ *c*_{1}, *c*_{2} ≤ *m*$) — the type and two coordinates of an action. Additionally, the following holds depending on the value of $*t*$:

翻译中…
  • If $*t* = 1$: $2 ≤ *r*_{1} ≤ *r*_{2} ≤ *n* - 1$, $2 ≤ *c*_{1} ≤ *c*_{2} ≤ *m* - 1$;
  • If $*t* = 2$: $2 ≤ *r*_{1} ≤ *r*_{2} ≤ *n* - 1$, $2 ≤ *c*_{1} ≤ *c*_{2} ≤ *m* - 1$, the specified group of barriers exist on the ground before the removal.
  • If $*t* = 3$: no extra restrictions.
翻译中…

Output

翻译中…

For each of Koyomi's attempts (actions with $*t* = 3$), output one line — containing "Yes" (without quotes) if it's feasible, and "No" (without quotes) otherwise.

翻译中…

Note

翻译中…

For the first example, the situations of Koyomi's actions are illustrated below.

翻译中…

image

翻译中…

样例

Input #1
5 6 5
1 2 2 4 5
1 3 3 3 3
3 4 4 1 1
2 2 2 4 5
3 1 1 4 4
Output #1
No
Yes
InputCopy OutputCopy
Input #2
2500 2500 8
1 549 1279 1263 2189
1 303 795 1888 2432
1 2227 622 2418 1161
3 771 2492 1335 1433
1 2017 2100 2408 2160
3 48 60 798 729
1 347 708 1868 792
3 1940 2080 377 1546
Output #2
No
Yes
No
InputCopy OutputCopy
题目信息
题号
869E
时间限制
2 s
内存限制
512 MB
标签
数据结构
哈希

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