Submission #1126438

#TimeUsernameProblemLanguageResultExecution timeMemory
1126438akacool445kExhibition (JOI19_ho_t2)C++20
100 / 100
44 ms2632 KiB
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define int long long
#define pint pair<int, int>
#define vint vector<pair<int, int>>
const int mod = 1e9 + 7;
const int shrek = 5e5 + 5;
const int say = INT_MAX;
const int gex = INT_MIN;
const int oo = 1e9;
// bool cmp(const pint&a, const pint&b) {
//     if(a.ff == b.ff) {
//         return a.ss < b.ss;
//     }
//     return a.ff > b.ff;
// }
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, m; cin >> n >> m;
    int c[m];
    vector<pair<int, int>> pic(n);
    for(int i = 0; i < n; i++) {
        cin >> pic[i].ss >> pic[i].ff; 
    }
    sort(pic.begin(), pic.end());
    reverse(pic.begin(), pic.end());
    for(int i = 0; i < m; i++) cin >> c[i];
    sort(c, c + m);
    reverse(c, c + m);
    int l = 0, r = 0;
    int ans = 0;
    while(l < n && r < m) {
        if(pic[l].ss <= c[r]) {
            ans++;
            l++;
            r++;
            continue;
        }
        l++;
    }
    cout << ans << '\n';

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