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
| #include <bits/stdc++.h>
using namespace std;
int solution(vector<int> A, vector<int> B) {
int answer = -1;
set<int> b;
for(int i=0;i<B.size();i++)
{
b.insert(B[i]);
}
answer = 0;
sort(A.begin(),A.end());
reverse(A.begin(),A.end());
//auto fs = b.begin();
for(auto u : A)
{
//cout << u <<"\n";
auto it = b.upper_bound(u);
if(it!=b.end())
{
answer++;
b.erase(it);
}
}
return answer;
}
|