Submission #786926

#TimeUsernameProblemLanguageResultExecution timeMemory
786926andecaandeciExhibition (JOI19_ho_t2)C++17
100 / 100
42 ms5560 KiB
#include <bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define keish                             ios_base::sync_with_stdio(0);       cin.tie(0); cout.tie(0)
      
using namespace std;

int n, m;

signed main(){
      keish;
      cin >> n >> m;
      vector<pair<int ,int>> a(n);
      for(int i = 0; i < n; i++) cin >> a[i].se >> a[i].fi;
      vector<int> c(m);
      for(int i = 0; i < m; i++) cin >> c[i];

      sort(a.rbegin(), a.rend());
      sort(c.rbegin(), c.rend());
      
      int id = 0, ans = 0;
      for(int i = 0; i < n and id < m; i++){
            if(a[i].se <= c[id]){
                  ans++;
                  id++;
            }
      }

      cout << ans << '\n';
}     
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...