이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |