제출 #110804

#제출 시각아이디문제언어결과실행 시간메모리
110804oolimryExhibition (JOI19_ho_t2)C++14
100 / 100
95 ms3576 KiB
#include <bits/stdc++.h>

using namespace std;

typedef pair<int, int> ii;
int main()
{
    //freopen("i.txt","r",stdin);
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    ii stuff[n];
    for(int i = 0;i < n;i++){
        cin >> stuff[i].second >> stuff[i].first;
    }

    int arr[m];
    for(int j = 0;j < m;j++){
        cin >> arr[j];
    }

    int low = 0;
    int high = m+1;
    sort(stuff,stuff+n);
    sort(arr,arr+m);
    while(true){
        int s = (low + high) / 2;
        if(low == high - 1) break;
        int c = m - s;

        for(int i = 0;i < n;i++){
            if(stuff[i].second <= arr[c]){
                c++;
                if(c == m) break;
            }
        }

        if(c == m) low = s;
        else high = s;

    }

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