Submission #1334540

#TimeUsernameProblemLanguageResultExecution timeMemory
1334540crispxxExhibition (JOI19_ho_t2)C++20
100 / 100
46 ms1476 KiB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

bool chmax(int &a, const int &b) {
	return a < b ? a = b, true : false;
}

void solve() {
	int n, m; cin >> n >> m;
	
	vector<array<int, 2>> a(n);
	
	for(int i = 0; i < n; i++) {
		cin >> a[i][1] >> a[i][0];
	}
	
	sort(a.begin(), a.end(), greater<>());
	
	vector<int> c(m);
	
	for(auto &x : c) cin >> x;
		
	sort(c.begin(), c.end(), greater<>());
	
	int j = 0;
	
	for(int i = 0; i < n && j < m; i++) {
		if(a[i][1] <= c[j]) {
			j++;
			// cout << a[i][1] << ' ' << c[j] << '\n';
			// mx = a[i][1];
		}
	}
	
	cout << j << '\n';
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...