제출 #844660

#제출 시각아이디문제언어결과실행 시간메모리
844660AlphaMale06Exhibition (JOI19_ho_t2)C++14
0 / 100
1 ms344 KiB
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
using namespace std;

bool cmp(pair<int, int> a, pair<int, int> b){
    if(a.F==b.F)return a.S<b.S;
    else return a.F>b.F;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    pair<int, int> a[n];
    int b[m];
    for(int i=0; i< n; i++){
        int x, y;
        cin >> x >> y;
        a[i]=mp(y, x);
    }
    for(int i=0; i< m; i++){
        cin >> b[i];
    }
    sort(b, b+m);
    sort(a, a+n, cmp);
    int p1=m-1;
    int ans=0;
    for(int i=0; i<n; i++){
        if(a[i].S<=b[p1]){
            p1--;
            ans++;
            if(p1==-1){
                break;
            }
        }
    }
    cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...