This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
using namespace std;
#define X first
#define Y second
pair<int, int> arr[100001];
int brr[100001];
bool cmp(pair<int, int>& a, pair<int, int>& b)
{
if(a.Y != b.Y)
return a.Y > b.Y;
return a.X > b.X;
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
for(int i = 0; i < n; i++)
cin >> arr[i].X >> arr[i].Y;
for(int i = 0; i < m; i++)
cin >> brr[i];
sort(arr, arr+n, cmp);
sort(brr, brr+m);
int ans = 0, pos = m-1;
for(int i = 0; i < n; i++)
if(pos >= 0 && arr[i].X <= brr[pos])
{
ans++;
pos--;
}
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... |