Submission #1180412

#TimeUsernameProblemLanguageResultExecution timeMemory
1180412anteknneExhibition (JOI19_ho_t2)C++20
100 / 100
32 ms1608 KiB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define st first
#define nd second
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define debug false

const int MAXN = 100 * 1000;
pii sv[MAXN];
int c[MAXN];

bool porownaj (pii a, pii b) {
    if (b.nd == a.nd) {
        return a.st > b.st;
    }
    return a.nd > b.nd;
}

int main () {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n, m;
    cin >> n >> m;

    for (int i = 0; i < n; i ++) {
        cin >> sv[i].st >> sv[i].nd;
    }

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

    sort(c, c + m);
    reverse(c, c + m);

    sort(sv, sv + n, porownaj);

    int ind = 0;
    for (int i = 0; i < n; i ++) {
        if (sv[i].st <= c[ind]) {
            ind ++;
        }
    }

    cout << ind << "\n";




    return 0;
}


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...