제출 #1131509

#제출 시각아이디문제언어결과실행 시간메모리
1131509lopkusExhibition (JOI19_ho_t2)C++20
100 / 100
43 ms2780 KiB
#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<pair<int,int>> a(n + 1);
    for(int i = 1; i <= n; i++) {
        cin >> a[i].second >> a[i].first;
    }
    vector<int> x(m + 1);
    for(int i = 1; i <= m; i++) {
        cin >> x[i];
    }
    sort(x.begin() + 1, x.end());
    sort(a.begin() + 1, a.end());
    int ans = 0;
    int X = n, Y = m;
    while(X > 0 && Y > 0) {
        if(x[Y] >= a[X].second) {
            Y -= 1;
            ans += 1;
        }
        X -= 1;
    }
    cout << ans;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...