#include <bits/stdc++.h>
using namespace std;
struct paint{
int s, v, i, m = -1;
};
int main(){
cin.tie(0);
cin.sync_with_stdio(0);
int N, M;
cin >> N >> M;
vector<int> p;
vector<int> f(M);
vector<paint> v(N);
for(int i=0; i<N; i++) v[i].i = i, cin >> v[i].s >> v[i].v;
for(auto &i : f) cin >> i;
sort(f.begin(), f.end());
sort(v.begin(), v.end(), [](const paint& a, const paint& b){
return a.v < b.v;
});
int ans = 0;
for(int i=N-1, j=M-1; i>=0 && j>=0; ){
if(v[i].s <= f[j]){
i--;
j--;
ans++;
}
else{
i--;
}
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |