Submission #787370

#TimeUsernameProblemLanguageResultExecution timeMemory
787370vjudge1Exhibition (JOI19_ho_t2)C++17
100 / 100
112 ms2788 KiB
#include<bits/stdc++.h>
using namespace std;
#define size second
#define value first

int N, M;
pair<int,int> picture[100100];
int frame[100100];
int ans;

int main() {
	cin >> N >> M;
	
	for(int i=1; i<=N; i++) {
		cin >> picture[i].size >> picture[i].value;
	}
	sort(picture+1, picture+N+1);
	
	for(int i=1; i<=M; i++) {
		cin >> frame[i];
	}
	sort(frame+1, frame+M+1);
	
	int i=N;
	int j=M;
	while(i>=1 && j>=1) {
		if (picture[i].size <= frame[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...