-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1971C.cpp
More file actions
62 lines (57 loc) · 1.67 KB
/
Copy path1971C.cpp
File metadata and controls
62 lines (57 loc) · 1.67 KB
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
// Created on 10-May-24
//
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
int main() {
int t;
cin >> t;
while (t--) {
int x, y, c, d;
cin >> x >> y >> c >> d;
int a = min(x, y);
int b = max(x, y);
vi v;
for (int i = a + 1; i < b; i++) {
v.push_back(i);
// cout<<i<<endl;
}
if ((b - a) == 1) cout << "NO" << endl;
else {
int flag=0;
for (int i = 0; i < v.size(); i++) {
if(flag==1) break;
if (v[i] == c) {
for (int j = 0; j < v.size(); j++) {
if (v[j] == d) {
cout << "NO" << endl;
flag=1;
break;
}
if (j == v.size() - 1) {
cout << "YES" << endl;
flag=1;
break;
}
}
} else if (v[i] == d) {
for (int j = 0; j < v.size(); j++) {
if (v[j] == c) {
cout << "NO" << endl;
flag=1;
break;
}
if (j == v.size() - 1) {
cout << "YES" << endl;
flag=1;
break;
}
}
}else if(i==v.size()-1){cout<<"NO"<<endl;}
}
}
}
return 0;
}