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 mod 1000000007
#define mp make_pair
#define pb push_back
#define bas(x) #x << ": " << x << " "
#define prarr(x, n) cout << #x << ": "; for (int qsd = 0; qsd < n; qsd++) cout << x[qsd] << " "; cout << endl;
#define prarrv(x) cout << #x << ": "; for (int qsd = 0; qsd < (int)x.size(); qsd++) cout << x[qsd] << " "; cout << endl;
#define ppair(x) "(" << x.first << ", " << x.second << ")"
#define inside sl<=l&&r<=sr
#define outside sr<l||r<sl
typedef long long ll;
int n, m;
pair<int, int> pics[100005];
int frames[100005];
int main(){
//freopen("in", "r", stdin);
//freopen("out", "w", stdout);
cin >> n >> m;
for (int i = 0; i < n; i++){
cin >> pics[i].second >> pics[i].first;
}
for (int i = 0; i < m; i++) cin >> frames[i];
sort(frames, frames+m);
sort(pics, pics+n);
int ans = 0;
int i = n-1;
int j = m-1;
while (i >= 0 && j >= 0){
if (pics[i].second <= frames[j]){
ans++;
i--;
j--;
} else i--;
}
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... |