#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
int b[m];
array<int, 2> a[n];
multiset<int> s;
for (array<int, 2> &x : a) cin >> x[0] >> x[1], s.insert(x[1]);
for (int &i : b) cin >> i;
sort(b, b + m);
sort(a, a + n);
int j = n - 1, res = 0;
for (int i = m - 1; i >= 0; i--)
{
while (j >= 0 && b[i] < a[j][0])
{
if (s.find(a[j][1]) != s.end()) s.erase(s.find(a[j][1]));
j--;
}
if (!s.empty()) res++, s.erase(--s.end());
}
cout << res << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |