Submission #139595

#TimeUsernameProblemLanguageResultExecution timeMemory
139595mlyean00Exhibition (JOI19_ho_t2)C++17
100 / 100
72 ms5752 KiB
#ifdef DEBUG
#include "debug.hpp"
#else
#pragma GCC optimize("Ofast")
#define trace(...)
#include <bits/stdc++.h>
#define endl '\n'
#endif

using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> val_sz(n);
    vector<ll> frame_sz(m);
    for (int i = 0; i < n; ++i) {
        cin >> val_sz[i].second >> val_sz[i].first;
    }
    for (int i = 0; i < m; ++i) {
        cin >> frame_sz[i];
    }
    sort(val_sz.begin(), val_sz.end());
    sort(frame_sz.begin(), frame_sz.end());

    int ans = 0;
    while (!val_sz.empty() && !frame_sz.empty()) {
        if (val_sz.back().second <= frame_sz.back()) {
            ++ans;
            frame_sz.pop_back();
        }
        val_sz.pop_back();
    }

    cout << ans << endl;

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...