Submission #575058

#TimeUsernameProblemLanguageResultExecution timeMemory
575058talant117408Exhibition (JOI19_ho_t2)C++17
100 / 100
54 ms1760 KiB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
 
#define pb                  push_back
#define mp                  make_pair
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define lb                  lower_bound
#define ub                  upper_bound
#define sz(v)               int((v).size())
#define do_not_disturb      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl                '\n'

void solve() {
    int n, m;
    cin >> n >> m;
    vector <pii> v(n);
    vector <int> c(m);
    for (auto &to : v) cin >> to.second >> to.first;
    for (auto &to : c) cin >> to;
    int j = 0;
    sort(rall(v));
    sort(rall(c));
    for (int i = 0; i < n; i++) {
        if (j < m && c[j] >= v[i].second) {
            j++;
        }
    }
    cout << j;
}

int main() {
    do_not_disturb
    
    int t = 1;
    //~ cin >> t;
    while (t--) {
        solve();
    }
    
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...