Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- int main()
- {
- _test
- {
- int n, m;
- cin>>n>>m;
- vector<int> a(n), b(n);
- a[0] = 1;
- for(int i=1; i<n; i++)
- cin>>a[i];
- for(auto &e: b) cin>>e;
- multiset<int> msta, mstb;
- for(auto e: a) msta.insert(e);
- for(auto e: b) mstb.insert(e);
- int cnt = 0;
- while(msta.size())
- {
- if(mstb.upper_bound(*msta.rbegin()) != mstb.end())
- {
- cnt++;
- mstb.erase(mstb.upper_bound(*msta.rbegin()));
- }
- msta.erase(--msta.end());
- }
- cout<<n - cnt<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment