This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |