Submission #370559

#TimeUsernameProblemLanguageResultExecution timeMemory
370559vot808Exhibition (JOI19_ho_t2)C++17
100 / 100
67 ms4588 KiB
#include "bits/stdc++.h"
using namespace std;
#define for_(i, s, e) for (int i = s; i < (int) e; i++)
#define for__(i, s, e) for (ll i = s; i < e; i++)
typedef long long ll;
typedef vector<int> vi;
typedef array<int, 2> ii;
#define endl '\n'


int main() {
#ifdef mlocal
	freopen("test.in", "r", stdin);
#endif
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m; cin >> n >> m;
	vector<ii> pic(n);
	vi sz(m);
	for_(i, 0, n) cin >> pic[i][1] >> pic[i][0];
	sort(pic.rbegin(), pic.rend());
	for_(i, 0, m) cin >> sz[i];
	sort(sz.rbegin(), sz.rend());
	
	int ans = 0, pt = 0;
	for_(i, 0, m) {
		while (pt < n and sz[i] < pic[pt][1]) {
			pt++;
		}
		if (pt < n) {
			pt++;
			ans++;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...