-
Notifications
You must be signed in to change notification settings - Fork 0
/
toph.cpp
60 lines (55 loc) · 855 Bytes
/
toph.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
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL);
#define ll long long
#define ull unsigned long long
#define nl "\n"
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
void solve()
{
int n,x;
cin>>n>>x;
vector<int> a(n),b(n),c(n);
for(int i=0;i<n;i++)
{
cin>>a[i];
}
for(int i=0;i<n;i++)
{
cin>>b[i];
}
for(int i=0;i<n;i++)
{
cin>>c[i];
}
int mn = min(a[0],b[0]);
mn = min(mn,c[0]);
if(mn > x)
{
cout<<"NO"<<nl;
return;
}
if(x == 0 || x == mn)
{
cout<<"YES"<<nl;
return;
}
if(a[0] == mn) dp();
if(b[0] == mn) dp();
if(c[0] == mn) dp();
}
int main()
{
// Faster Input Output
FAST
int q = 1; cin>>q;
for (int i=1;i<=q;i++)
{
//cout<<"Case "<<i<<": ";
solve();
}
return 0;
}