-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathB_Matrix_Rotation.cpp
63 lines (60 loc) · 976 Bytes
/
B_Matrix_Rotation.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <bits/stdc++.h>
using namespace std;
void resolu() {
string str;
vector <int> b(4);
string bu="";
for (int i=0;i<4;i++){
cin>>b[i];
}
int b0=b[0];
int b1=b[1];
int b2=b[2];
int b3=b[3];
if (b[0]<b[2] && b[0]<b[1] && b[1]<b[3] && b[2]<b[3]){
bu="YES";
}
for (int i=0;i<4;i++){
b[0]=b2;
b[1]=b0;
b[2]=b3;
b[3]=b1;
if (b[0]<b[2] && b[0]<b[1] && b[1]<b[3] && b[2]<b[3]){
bu="YES";
break;
}
}
for (int i=0;i<4;i++){
b[0]=b3;
b[1]=b2;
b[2]=b1;
b[3]=b0;
if (b[0]<b[2] && b[0]<b[1] && b[1]<b[3] && b[2]<b[3]){
bu="YES";
break;
}
}
for (int i=0;i<4;i++){
b[0]=b1;
b[1]=b3;
b[2]=b0;
b[3]=b2;
if (b[0]<b[2] && b[0]<b[1] && b[1]<b[3] && b[2]<b[3]){
bu="YES";
break;
}
}
if (bu=="YES"){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
int main(){
long long t;
cin >> t;
while (t--){
resolu();
}
}