Submission #234934

#TimeUsernameProblemLanguageResultExecution timeMemory
234934davitmargExhibition (JOI19_ho_t2)C++17
0 / 100
5 ms384 KiB
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
#define fastIO ios::sync_with_stdio(false); cin.tie(0)
using namespace std;

const int N = 100005;

int n, k, c[N],ans;
pair<int, int> a[N];

int main()
{
	fastIO;
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
		cin >> a[i].first >> a[i].second;
	for (int i = 1; i <= k; i++)
		cin >> c[i];

	sort(c + 1, c + 1 + k);
	sort(a + 1, a + 1 + n, [](pair<int, int> a, pair<int, int> b) {
		if (a.second != b.second)
			return a.second < b.second;
		return a < b;
	});

	for (int i = n; i >= 1; i--)
	{
		int x = lower_bound(c + 1, c + 1 + k, a[i].first) - c;
		if (n - x >= ans)
			ans++;
	}

	cout << ans << endl;

	return 0;
}

/*

4 3
1 1
1 1
2 0
2 2
1
1
2


*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...