제출 #703680

#제출 시각아이디문제언어결과실행 시간메모리
703680qwe1rt1yuiop1Exhibition (JOI19_ho_t2)C++14
0 / 100
1 ms340 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
typedef pair<int, int> pii;

inline void solve()
{
    int n, m;
    cin >> n >> m;
    vector<pii> v(n);
    for (pii &i : v)
        cin >> i.second >> i.first;
    vector<int> f(m);
    for (auto &i : f)
        cin >> i;
    sort(v.begin(), v.end()), sort(f.begin(), f.end());
    reverse(v.begin(), v.end()), reverse(f.begin(), f.end());

    // cout << '\n';
    // for (auto i : v)
    //     cout << i.first << ' ' << i.second << '\n';
    // for (int i : f)
    //     cout << i << ' ';
    // cout << '\n';

    int mx = 0, cur = 0;
    for (pii i : v)
    {
        while (cur >= 0 && f[cur] < i.second)
            --cur;
        mx = max(mx, ++cur);
    }
    cout << min(mx, m) << '\n';
}

signed main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

    solve();

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