제출 #301987

#제출 시각아이디문제언어결과실행 시간메모리
301987MylnikovNikolayExhibition (JOI19_ho_t2)C++17
100 / 100
56 ms4612 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair <ll , ll> pll;
typedef pair <int , int> pii;

#define fi first
#define se second
//#define int ll

const int intf = 2e9 , maxn = 1e5 + 5;
const ll inf = 2e18 , mod = 1e9 + 7;


void solve(){
    int n , m; cin >> n >> m;
    vector <pii> a(n);
    vector <int> r(m);
    for (auto &x : a){
        cin >> x.se >> x.fi;
    }
    sort(a.begin() , a.end());
    for (auto &x : r){
        cin >> x;
    }
    sort(r.begin() , r.end());

    int i = n - 1 , j = m - 1 , ans = 0;
    while(i >= 0 && j >= 0){
        if (a[i].se <= r[j]){
            j--;
            ans++;
        }
        i--;
    }
    cout << ans;
}

signed main() {
    //freopen("input.txt" , "r" , stdin);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(20);

    int t = 1; //cin >> t;
    while(t-->0){
        solve();
    }

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