Submission #478410

#TimeUsernameProblemLanguageResultExecution timeMemory
478410FireGhost1301Exhibition (JOI19_ho_t2)C++11
100 / 100
56 ms4440 KiB
/**
    __author__ : FireGhost
    problems_ID: JOI19_ho_t2
 */

#include <bits/stdc++.h>
using namespace std;

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;

const int N = 1e5 + 3;
const int MOD = 1e9 + 7;

int n, m;
vector<int> c;
vector<pii> a;

void solve() {
    cin >> n >> m;
    a.resize(n), c.resize(m);
    for (int i = 0; i < n; ++i)
        cin >> a[i].se >> a[i].fi;
    for (int i = 0; i < m; ++i)
        cin >> c[i];
    sort(a.rbegin(), a.rend());
    sort(c.rbegin(), c.rend());
    int j = 0;
    for (int i = 0; i < n && j < m; ++i) {
        if (a[i].se > c[j]) continue;
        ++j;
    }
    cout << j;
}

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    int t = 1;
    while (t--)
        solve();
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...