#include <bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18;
signed main(){
int n, m; cin >> n >> m;
vector<pair<int, int>> a(n);
vector<int> c(m);
for (int i = 0; i < n; i++){
cin >> a[i].second >> a[i].first;
}
sort(a.begin(), a.end());
for (int i = 0; i < m; i++){
cin >> c[i];
}
sort(c.begin(), c.end());
int ans = 0;
for (int i = 0; i < m; i++){
int cur = 0;
int last = -1;
for (int j = i; j < m; j++){
int k = 0;
while(k < n && (last == -1 || a[k].first >= a[last].first)){
if (a[k].second <= c[j]){
cur++;
last = k;
break;
}
k++;
}
}
ans = max(ans, cur);
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |