This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*input
8 8
508917604 35617051
501958939 840246141
485338402 32896484
957730250 357542366
904165504 137209882
684085683 775621730
552953629 20004459
125090903 607302990
433255278
979756183
28423637
856448848
276518245
314201319
666094038
149542543
*/
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
ios_base::sync_with_stdio(false);
ll n, m;
cin >> n >> m;
vector<pair<ll, ll>>x;
while (n--)
{
ll s, v;
cin >> s >> v;
x.push_back({v, s});
}
sort(x.begin(), x.end(), greater<pair<ll, ll>>());
vector<ll>cc;
for (auto i : x)
cc.push_back(i.second);
vector<ll>c(m);
for (ll &i : c)
cin >> i;
sort(c.begin(), c.end());
ll ans = 0;
for (ll i : cc)
{
if (c.size() > 0 && c.back() >= i)
{
ans++;
c.pop_back();
}
}
cout << ans << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |