제출 #831674

#제출 시각아이디문제언어결과실행 시간메모리
831674OAleksaExhibition (JOI19_ho_t2)C++14
100 / 100
39 ms5580 KiB
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std; 
#define int long long
const int maxn = 1e5 + 69;
int n, m, c[maxn];
pair<int, int> a[maxn];
signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tt = 1;
	//cin >> tt;
	while(tt--) {
		cin >> n >> m;
		for(int i = 0;i < n;i++) 
			cin >> a[i].s >> a[i].f;
		for(int i = 0;i < m;i++)
			cin >> c[i];
		sort(c, c + m);
		sort(a, a + n);
		int i = n - 1, j = m - 1, ans = 0;
		while(i >= 0 && j >= 0) {
			if(c[j] >= a[i].s) 
				++ans, --j;
			--i;
		}
		cout << ans;
	}
   return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...