Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define all(a) (a).begin(), (a).end()
- const int maxn = 200500;
- int a[maxn];
- int b[maxn];
- bool used[maxn];
- int n, m;
- void solve() {
- cin >> n;
- for (int i = 0; i < n; ++i) {
- cin >> a[i];
- }
- cin >> m;
- for (int i = 0; i < m; ++i) {
- cin >> b[i];
- }
- sort(b, b + m);
- for (int i = 0; i < n; ++i) {
- bool f = false;
- for (int j = 0; j < m; ++j) {
- if (used[j])
- continue;
- if (b[j] >= a[i]) {
- used[j] = true;
- f = true;
- break;
- }
- }
- if (!f)
- break;
- }
- int ans = 0;
- for (int i = 0; i < m; ++i) {
- ans += used[i];
- }
- cout << ans << '\n';
- }
- signed main() {
- ios::sync_with_stdio(0); cin.tie(0);
- solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement