제출 #640585

#제출 시각아이디문제언어결과실행 시간메모리
640585ymmExhibition (JOI19_ho_t2)C++17
100 / 100
46 ms4428 KiB
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;

const int N = 100'010;
int f[N];
pii p[N];
int n, m;

int main()
{
	cin.tie(0) -> sync_with_stdio(false);
	cin >> n >> m;
	Loop (i,0,n)
		cin >> p[i].second >> p[i].first;
	Loop (i,0,m)
		cin >> f[i];
	sort(f, f+m, greater());
	sort(p, p+n, greater());
	int ans = 0;
	for (int i = 0, j = 0; i < m; ++i) {
		while (j < n && p[j].second > f[i])
			++j;
		if (j == n)
			break;
		++j;
		++ans;
	}
	cout << ans << '\n';
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...