CF869E.The Untended Antiquity

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

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×mn×m cells, arranged into nn rows and mm columns. The cc -th cell in the rr -th row is denoted by (r,c)(r,c) .

Oshino places and removes barriers around rectangular areas of cells. Specifically, an action denoted by " 1 r1 c1 r2 c21\ r_{1}\ c_{1}\ r_{2}\ c_{2} " means Oshino's placing barriers around a rectangle with two corners being (r1,c1)(r_{1},c_{1}) and (r2,c2)(r_{2},c_{2}) and sides parallel to squares sides. Similarly, " 2 r1 c1 r2 c22\ 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×mn×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 r1 c1 r2 c23\ r_{1}\ c_{1}\ r_{2}\ c_{2} " means that Koyomi tries to walk from (r1,c1)(r_{1},c_{1}) to (r2,c2)(r_{2},c_{2}) without crossing barriers.

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

输入格式

The first line of input contains three space-separated integers nn , mm and qq ( 1<=n,m<=25001<=n,m<=2500 , 1<=q<=1000001<=q<=100000 ) — the number of rows and columns in the grid, and the total number of Oshino and Koyomi's actions, respectively.

The following qq lines each describes an action, containing five space-separated integers tt , r1r_{1} , c1c_{1} , r2r_{2} , c2c_{2} ( 1<=t<=31<=t<=3 , 1<=r1,r2<=n1<=r_{1},r_{2}<=n , 1<=c1,c2<=m1<=c_{1},c_{2}<=m ) — the type and two coordinates of an action. Additionally, the following holds depending on the value of tt :

  • If t=1t=1 : 2<=r1<=r2<=n12<=r_{1}<=r_{2}<=n-1 , 2<=c1<=c2<=m12<=c_{1}<=c_{2}<=m-1 ;
  • If t=2t=2 : 2<=r1<=r2<=n12<=r_{1}<=r_{2}<=n-1 , 2<=c1<=c2<=m12<=c_{1}<=c_{2}<=m-1 , the specified group of barriers exist on the ground before the removal.
  • If t=3t=3 : no extra restrictions.

输出格式

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

输入输出样例

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

    输出#1

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

    输出#2

    No
    Yes
    No
    

说明/提示

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

首页