Submission #163277

#TimeUsernameProblemLanguageResultExecution timeMemory
163277iefnah06Exhibition (JOI19_ho_t2)C++11
100 / 100
83 ms4528 KiB
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 100010;
const int MAXM = 100010;
int N, M;
pair<int, int> VS[MAXN];
int C[MAXM];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N >> M;
	for (int i = 0; i < N; i++) {
		cin >> VS[i].second >> VS[i].first;
	}
	for (int i = 0; i < M; i++) {
		cin >> C[i];
	}
	sort(VS, VS + N);
	sort(C, C + M);

	int ans = 0;
	for (int i = N - 1, j = M - 1; i >= 0; i--) {
		int v, s; tie(v, s) = VS[i];
		if (j >= 0 && s <= C[j]) {
			ans++;
			j--;
		}
	}
	cout << ans << '\n';

	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...