forked from EnigmaVSSUT/CompetitiveCoding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWATCHFB.cpp
More file actions
55 lines (51 loc) · 1.25 KB
/
WATCHFB.cpp
File metadata and controls
55 lines (51 loc) · 1.25 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
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll t;
cin>>t;
while(t--)
{
ll n;
cin>>n;
ll a = 0, b =0;
while(n--)
{
ll q,a1,b1;
cin>>q>>a1>>b1;
if(q==1)
{
a = a1;b = b1;
cout<<"YES"<<endl;
}
else
{
ll max12 = max(a1,b1),min12 = min(a1,b1),max11 = max(a,b),min11 = min(a,b);
if(max12==min12)
{
a = max12,b =min12;
cout<<"YES"<<endl;
}
else if (min12>=max11)
{
cout<<"NO"<<endl;
}
else if ((min12>=min11&&min12<=max11)&&(max12>=max11))
{
if(a==min11)
{
a = min12;b=max12;
}
else if (b==min11)
{
b = min12;a = max12;
}
cout<<"YES"<<endl;
}
}
}
}
return 0;
}