Submission #725040

#TimeUsernameProblemLanguageResultExecution timeMemory
725040sandry24Exhibition (JOI19_ho_t2)C++17
100 / 100
146 ms3212 KiB
#include <bits/stdc++.h>
using namespace std;

//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second

void solve(){
    int n, m;
    cin >> n >> m;
    vector<pi> a(n);
    vi b(m);
    for(int i = 0; i < n; i++)
        cin >> a[i].s >> a[i].f;
    for(int i = 0; i < m; i++)
        cin >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int j = m-1; 
    for(int i = n-1; i >= 0; i--){
        if(a[i].s <= b[j])
            j--;
        if(j < 0)
            break;
    }
    cout << m - j - 1 << '\n';
}

int main(){
    //freopen("input.txt", "r", stdin);
    //freopen("test.out", "w", stdout);
    //ios::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...