310013: CF1772B. Matrix Rotation

Memory Limit:512 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Matrix Rotation

题意翻译

给定 $t$ 个 $2\times2$ 的矩阵,定义每列中左侧数字小于右侧数字、上面数字小于下面数组为一个优秀的矩阵。每一次操作是指顺时针调整矩阵一次,问能否经过若干次操作(或者不操作)使其变为优秀的矩阵。 数据范围:$1\le t \le 1000$。

题目描述

You have a matrix $ 2 \times 2 $ filled with distinct integers. You want your matrix to become beautiful. The matrix is beautiful if the following two conditions are satisfied: - in each row, the first element is smaller than the second element; - in each column, the first element is smaller than the second element. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1772B/3883cb5d5c3c3237649026ca712db7066e7d51ae.png)You can perform the following operation on the matrix any number of times: rotate it clockwise by $ 90 $ degrees, so the top left element shifts to the top right cell, the top right element shifts to the bottom right cell, and so on: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF1772B/a844c7395726cf76b3147efc79ccce4d8f167fbf.png)Determine if it is possible to make the matrix beautiful by applying zero or more operations.

输入输出格式

输入格式


The first line contains one integer $ t $ ( $ 1 \le t \le 1000 $ ) — the number of test cases. Each test case consists of two lines. Each of those lines contains two integers — the elements of the corresponding row of the matrix. In each matrix, all four elements are distinct integers from $ 1 $ to $ 100 $ .

输出格式


For each test case, print YES if the matrix can become beautiful, or NO otherwise. You may print each letter in any case (YES, yes, Yes will all be recognized as positive answer, NO, no and nO will all be recognized as negative answer).

输入输出样例

输入样例 #1

6
1 3
5 7
8 10
3 4
8 10
4 3
6 1
9 2
7 5
4 2
1 2
4 3

输出样例 #1

YES
YES
NO
YES
YES
NO

Input

题意翻译

给定 $t$ 个 $2\times2$ 的矩阵,定义每列中左侧数字小于右侧数字、上面数字小于下面数组为一个优秀的矩阵。每一次操作是指顺时针调整矩阵一次,问能否经过若干次操作(或者不操作)使其变为优秀的矩阵。 数据范围:$1\le t \le 1000$。

Output

**矩阵旋转**

**题意翻译**
给定 $ t $ 个 $2\times2$ 的矩阵,定义每列中左侧数字小于右侧数字、上面数字小于下面数字为一个优秀的矩阵。每一次操作是指顺时针调整矩阵一次,问能否经过若干次操作(或者不操作)使其变为优秀的矩阵。

数据范围:$1\le t \le 1000$。

**题目描述**
你有一个 $2 \times 2$ 的矩阵,其中包含四个不同的整数。你希望这个矩阵变得美丽。当以下两个条件同时满足时,矩阵是美丽的:

- 在每一行中,第一个元素小于第二个元素;
- 在每一列中,第一个元素小于第二个元素。

你可以对矩阵进行任意次数的以下操作:顺时针旋转 $90$ 度,使得左上角的元素移动到右上角的单元格,右上角的元素移动到右下角的单元格,以此类推。

确定是否可以通过应用零次或多次操作使矩阵变得美丽。

**输入输出格式**

**输入格式**
第一行包含一个整数 $ t $ ($ 1 \le t \le 1000 $)——测试用例的数量。

每个测试用例由两行组成。每行包含两个整数——矩阵对应行的元素。在每一个矩阵中,四个元素都是 $1$ 到 $100$ 之间的不同整数。

**输出格式**
对于每个测试用例,如果矩阵可以变得美丽,则打印 YES,否则打印 NO。你可以以任何大小写打印每个字母(YES, yes, Yes 都将被识别为肯定答案,NO, no, nO 都将被识别为否定答案)。

**输入输出样例**

**输入样例 #1**
```
6
1 3
5 7
8 10
3 4
8 10
4 3
6 1
9 2
7 5
4 2
1 2
4 3
```

**输出样例 #1**
```
YES
YES
NO
YES
YES
NO
```**矩阵旋转** **题意翻译** 给定 $ t $ 个 $2\times2$ 的矩阵,定义每列中左侧数字小于右侧数字、上面数字小于下面数字为一个优秀的矩阵。每一次操作是指顺时针调整矩阵一次,问能否经过若干次操作(或者不操作)使其变为优秀的矩阵。 数据范围:$1\le t \le 1000$。 **题目描述** 你有一个 $2 \times 2$ 的矩阵,其中包含四个不同的整数。你希望这个矩阵变得美丽。当以下两个条件同时满足时,矩阵是美丽的: - 在每一行中,第一个元素小于第二个元素; - 在每一列中,第一个元素小于第二个元素。 你可以对矩阵进行任意次数的以下操作:顺时针旋转 $90$ 度,使得左上角的元素移动到右上角的单元格,右上角的元素移动到右下角的单元格,以此类推。 确定是否可以通过应用零次或多次操作使矩阵变得美丽。 **输入输出格式** **输入格式** 第一行包含一个整数 $ t $ ($ 1 \le t \le 1000 $)——测试用例的数量。 每个测试用例由两行组成。每行包含两个整数——矩阵对应行的元素。在每一个矩阵中,四个元素都是 $1$ 到 $100$ 之间的不同整数。 **输出格式** 对于每个测试用例,如果矩阵可以变得美丽,则打印 YES,否则打印 NO。你可以以任何大小写打印每个字母(YES, yes, Yes 都将被识别为肯定答案,NO, no, nO 都将被识别为否定答案)。 **输入输出样例** **输入样例 #1** ``` 6 1 3 5 7 8 10 3 4 8 10 4 3 6 1 9 2 7 5 4 2 1 2 4 3 ``` **输出样例 #1** ``` YES YES NO YES YES NO ```

加入题单

算法标签: