forked from siddharthsonii/Hack-Fest-22
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodeGladiator2020Problem2(OpenRound)-Solution2
73 lines (73 loc) · 1.64 KB
/
CodeGladiator2020Problem2(OpenRound)-Solution2
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
69
70
71
72
73
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const long long MAX_SIZE = 101;
vector<long long >isprime(MAX_SIZE , true);
vector<long long >prime;
vector<long long >SPF(MAX_SIZE);
void manipulated_seive()
{
ll N=MAX_SIZE;
isprime[0] = isprime[1] = false ;
for (long long int i=2; i<N ; i++) {
if (isprime[i]) {
prime.push_back(i);
SPF[i] = i;
}
for (long long int j=0;
j < (int)prime.size() &&
i*prime[j] < N && prime[j] <= SPF[i];
j++)
{
isprime[i*prime[j]]=false;
SPF[i*prime[j]] = prime[j] ;
}
}
}
int main(){
isprime[i*prime[j]]=false;
SPF[i*prime[j]] = prime[j] ;
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
manipulated_seive();
ll t,n;
cin>>t;
while(t--){
manipulated_seive();
cin>>n;
vector<ll> arr(n);
for(ll i=0;i<n;i++)
cin>>arr[i];
sort(arr.begin(),arr.end(),greater<ll>());
vector<ll> brr(n);}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
manipulated_seive();
ll t,n;
cin>>t;
while(t--){
manipulated_seive();
cin>>n;
vector<ll> arr(n);
for(ll i=0;i<n;i++)
cin>>arr[i];
sort(arr.begin(),arr.end(),greater<ll>());
vector<ll> brr(n);
for(ll i=0;i<n;i++)
cin>>brr[i];
sort(brr.begin(),brr.end(),greater<ll>());
ll i=0,j=0,c=0;
while(i<n && j<n){
if(arr[i]>brr[j]){
c++;
i++;
}
j++;
}
cout<<c<<"\n";
}
return 0;
}