#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int n, m;
pair<int, int> a[maxn];
int b[maxn];
bool cmp(pair<int, int> p1, pair<int, int> p2)
{
if (p1.second == p2.second)
{
return p1.first <= p2.first;
}
return p1.second > p2.second;
}
void fastIO()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
int main()
{
fastIO();
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, cmp);
sort(b + 1, b + m + 1, greater<int>());
int ans = 0;
int ptr = 1;
for (int i = 1; i <= n && ptr <= m; ++i)
{
if (a[i].first <= b[ptr])
{
++ans;
++ptr;
}
}
cout << ans << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |