-
Notifications
You must be signed in to change notification settings - Fork 0
/
BREAK.cpp
68 lines (62 loc) · 1.54 KB
/
BREAK.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
64
65
66
67
68
#include <bits/stdc++.h>
// #define int long long int
#define MP make_pair
#define PB push_back
#define rep(i, a, b) for (int i=a; i<b; i++)
#define endl "\n"
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// your code goes here
int t , n , s , arr[100001] , brr[100001];
cin>>t>>s ;
while(t--)
{
set<int> wazzzzaaaa ;
cin>>n ;
rep(c,0,n)
cin>>arr[c] ;
rep(c,0,n)
cin>>brr[c] ;
if(*min_element(arr,arr+n) >= *min_element(brr,brr+n))
{
cout<<"NO"<<endl ;
continue ;
}
set <int, greater <int> > gquiz1;
// insert elements in random order
gquiz1.insert(40);
gquiz1.insert(30);
gquiz1.insert(60);
sort(arr,arr+n) ;
sort(brr,brr+n) ;
wazzzzaaaa.insert(*min_element(arr,arr+n)) ;
wazzzzaaaa.insert(*min_element(brr,brr+n)) ;
int flag = 0 ;
rep(i,1,n)
{
// it = find(wazzzzaaaa.begin(), wazzzzaaaa.end(), a[i]);
if(arr[i]<brr[i] and wazzzzaaaa.find(arr[i])!=wazzzzaaaa.end())
{
wazzzzaaaa.insert(arr[i]) ;
wazzzzaaaa.insert(brr[i]) ;
}
else
{
flag = 1 ;
break ;
}
}
gquiz1.insert(20);
gquiz1.insert(50);
gquiz1.insert(50); // only one 50 will be added to the set
gquiz1.insert(10);
if(flag)
cout<<"NO"<<endl ;
else
cout<<"YES"<<endl ;
}
return 0;
}