제출 #209200

#제출 시각아이디문제언어결과실행 시간메모리
209200mcdx9524Exhibition (JOI19_ho_t2)C++14
100 / 100
78 ms2288 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector <pair <int, int> > p;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    p.push_back({y, x});
  }
  sort(p.begin(), p.end());
  vector <int> c;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    c.push_back(x);
  }
  sort(c.begin(), c.end());
  int ans = 0;
  int ptr = m - 1;
  for (int i = n - 1; i >= 0; i--) {
    if (ptr >= 0 && c[ptr] >= p[i].second) {
      ptr--;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...