Submission #532002

#TimeUsernameProblemLanguageResultExecution timeMemory
532002abc864197532Exhibition (JOI19_ho_t2)C++17
100 / 100
50 ms4408 KiB
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define mp make_pair
#define eb emplace_back
#define pb push_back
#define pii pair<int,int>
#define X first
#define Y second
#define all(x) x.begin(), x.end()
void abc() {cout << endl;}
template <typename T, typename ...U> void abc(T i, U ...j) {
	cout << i << ' ', abc(j...);
}
template <typename T> void printv(T l, T r) {
	for (; l != r; ++l)
		cout << *l << " \n"[l + 1 == r];
}
#ifdef Doludu
#define test(x...) abc("[" + string(#x) + "]", x)
#define owo freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#else
#define test(x...) void(0)
#define owo ios::sync_with_stdio(false), cin.tie(0)
#endif
const int N = 100005;

int main () {
	owo;
	int n, m;
	cin >> n >> m;
	vector <pii> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i].Y >> a[i].X;
	sort(all(a));
	vector <int> b(m);
	for (int i = 0; i < m; ++i)
		cin >> b[i];
	sort(all(b));
	int ans = 0;
	for (int i = n - 1, j = m - 1; ~j; --j) {
		while (~i && a[i].Y > b[j])
			--i;
		if (~i)
			i--, ans++;
		if (i == -1)
			break;
	}
	cout << ans << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...