Submission #1296364

#TimeUsernameProblemLanguageResultExecution timeMemory
1296364hynmjExhibition (JOI19_ho_t2)C++20
0 / 100
1 ms568 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const long long N = 2e5 + 5;
int a[N];
struct photo
{
    int value, size;
};
void solve()
{
    int n, m;

    cin >> n >> m;
    vector<photo> a(n);
    vector<int> frame;
    int e;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i].size >> a[i].value;
    }
    for (int i = 0; i < m; i++)
    {
        cin >> e;
        frame.push_back(e);
    }
    sort(frame.rbegin(), frame.rend());
    sort(a.begin(), a.end(), [&](photo a, photo b)
         { return a.value < b.value; });
    int j = 0;
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (j < m and a[i].value <= frame[i])
        {
            j++;
            ans++;
        }
    }
    cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++)
    {
        // cout << "Case #" << i << ':' << ' ';
        solve();
        cout << endl;
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...