#include "bits/stdc++.h"
using namespace std;
const int maxn = 200005;
using ll = long long;
pair<ll, ll> p[maxn];
ll c[maxn];
int main(int argc, char const *argv[])
{
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
for(int i = 1; i <= n; ++i){
cin >> p[i].first >> p[i].second;
}
for(int i = 1; i <= m; ++i){
cin >> c[i];
}
sort(p + 1, p + n + 1, [&](pair<int, int> x, pair<int, int> y){
return x.second < y.second;
});
sort(c + 1, c + m + 1);
int ptr = n, ans = 0;
for(int i = m; i > 0 && ptr > 0; --i){
while(ptr > 0 && p[ptr].first > c[i]){
--ptr;
}
if(ptr > 0 && p[ptr].first <= c[i]){
++ans;
--ptr;
}
}
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |