#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
using namespace std;
bool cmp(pair<int, int> a, pair<int, int> b){
if(a.F==b.F)return a.S<b.S;
else return a.F>b.F;
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
pair<int, int> a[n];
int b[m];
for(int i=0; i< n; i++){
int x, y;
cin >> x >> y;
a[i]=mp(y, x);
}
for(int i=0; i< m; i++){
cin >> b[i];
}
sort(b, b+m);
sort(a, a+n, cmp);
int p1=m-1;
int ans=0;
for(int i=0; i<n; i++){
if(a[i].S<=b[p1]){
p1--;
ans++;
if(p1==-1){
break;
}
}
}
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |