Submission #136764

#TimeUsernameProblemLanguageResultExecution timeMemory
136764SirCenessExhibition (JOI19_ho_t2)C++14
100 / 100
285 ms1728 KiB
#include <bits/stdc++.h>

using namespace std;
#define mod 1000000007
#define mp make_pair
#define pb push_back
#define bas(x) #x << ": " << x << " "
#define prarr(x, n) cout << #x << ": "; for (int qsd = 0; qsd < n; qsd++) cout << x[qsd] << " "; cout << endl;
#define prarrv(x) cout << #x << ": "; for (int qsd = 0; qsd < (int)x.size(); qsd++) cout << x[qsd] << " "; cout << endl;
#define ppair(x) "(" << x.first << ", " << x.second << ")"
#define inside sl<=l&&r<=sr
#define outside sr<l||r<sl

typedef long long ll;

int n, m;
pair<int, int> pics[100005];
int frames[100005];

int main(){
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	
	cin >> n >> m;
	for (int i = 0; i < n; i++){
		cin >> pics[i].second >> pics[i].first;
	}
	for (int i = 0; i < m; i++) cin >> frames[i];

	sort(frames, frames+m);
	sort(pics, pics+n);

	int ans = 0;
	int i = n-1;
	int j = m-1;
	while (i >= 0 && j >= 0){
		if (pics[i].second <= frames[j]){
			ans++;
			i--;
			j--;
		} else i--;
	}
	cout << ans << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...