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 ff first
#define ss second
#define all(a) a.begin(), a.end()
const int mod = 1e9 + 7;
const int N = 1e5;
#define int long long
signed main(){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, m; cin >> n >> m;
vector< array<int, 2> > a(n);
for(int i = 0;i < n; i++){
cin >> a[i][0] >> a[i][1];
}
sort(all(a), [&](auto A, auto B){
if(A[1] == B[1]) return A[0] < B[0];
return A[1] < B[1];
});
vector<int> frame(m);
for(auto &e : frame) cin >> e;
sort(all(frame));
reverse(all(frame));
int ans = 0;
for(int i = 0;i < m; i++){
while(a.empty() == false && a.back()[0] > frame[i]) a.pop_back();
if(a.empty()) break;
ans++;
a.pop_back();
}
cout << ans;
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... |