Submission #130621

#TimeUsernameProblemLanguageResultExecution timeMemory
130621dooweyExhibition (JOI19_ho_t2)C++14
100 / 100
75 ms4572 KiB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;
 
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main(){
    fastIO;
    int n, m;
    cin >> n >> m;
    pii v[n];
    for(int i = 0 ; i < n; i ++ ){
        cin >> v[i].se >> v[i].fi;
    }
    sort(v, v + n);
    int sz[m];
    for(int i =0 ; i < m; i ++ )
        cin >> sz[i];
    sort(sz, sz + m);
    int p = n - 1;
    int res = 0;
    for(int i = m - 1 ; i >= 0 ; i -- ){
        while(p >= 0){
            if(v[p].se <= sz[i]){
                res ++ ;
                p -- ;
                break;
            }
            p -- ;
        }
    }
    cout << res;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...