Submission #1024142

#TimeUsernameProblemLanguageResultExecution timeMemory
1024142vux2codeExhibition (JOI19_ho_t2)C++17
100 / 100
39 ms6256 KiB
// Src : Vux2Code
#include <bits/stdc++.h>
#define pq_rvs pll,vector<pll>,greater<pll>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

const ll maxN = 1e6 + 5, inf64 = 1e18, mod = 1e9 + 7, maxLog = 20;
ll t = 1;

ll n, m, b [maxN];
pll a [maxN];

void solve () {
    cin >> n >> m;
	for (int i = 1; i <= n; i ++) cin >> a [i]. first >> a [i]. second;
	for (int i = 1; i <= m; i ++) cin >> b [i];
	sort (a + 1, a + n + 1, [&](pll x, pll y){
		if (x. second != y. second) return x. second > y. second;
		return x. first > y. first;
	});
	sort (b + 1, b + m + 1, greater <ll> ());
	int j = 1;
	for (int i = 1; (i <= n && j <= m); i ++) if (a [i]. first <= b [j]) j ++;
	cout << j - 1;
}

int main (){
	ios::sync_with_stdio (0);
	cin. tie (0);
	cout. tie (0);
	//freopen (".inp", "r", stdin);
	//freopen (".out", "w", stdout);
	//cin >> t;
    while (t --) solve ();
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...