This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// 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 + n + 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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |