Submission #1167247

#TimeUsernameProblemLanguageResultExecution timeMemory
1167247chikien2009Exhibition (JOI19_ho_t2)C++20
100 / 100
122 ms1556 KiB
#include <bits/stdc++.h>

using namespace std;

inline void setup()
{
#ifndef ONLINE_JUDGE
    freopen("test.inp", "r", stdin);
    freopen("test.out", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int n, m,c[100000], res = 0;
pair<int, int> p[100000];

inline bool comp(const pair<int, int> & ina, const pair<int, int> & inb)
{
    return (ina.second != inb.second ? ina.second > inb.second : ina.first > inb.first);
}

int main()
{
    // setup();

    cin >> n >> m;
    for (int i = 0; i < n; ++i)
    {
        cin >> p[i].first >> p[i].second;
    }
    for (int i = 0; i < m; ++i)
    {
        cin >> c[i];
    }
    sort(c, c + m, greater<int>());
    sort(p, p + n, comp);
    for (int i = 0, j = 0; i < n && j < m; ++i)
    {
        if (c[j] >= p[i].first)
        {
            res++;
            j++;
        }
    }
    cout << res;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...