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;
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){
if(x.second == y.second){
return x.first < y.first;
}else {
return x.second < y.second;
}
});
sort(c + 1, c + m + 1);
int ptr = n, ans = 0;
for(int i = m; i > 0; --i){
while(ptr > 0 && p[ptr].first > c[i]){
--ptr;
}
if(ptr > 0){
++ans;
--ptr;
}
}
cout << ans << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |