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;
typedef long long ll;
int main()
{
#ifdef ONPC
freopen("input.txt", "r", stdin);
#endif // ONPC
#ifndef ONPC
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif // ONPC
int n, m;
cin >> n >> m;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; i++)
{
cin >> a[i].first >> a[i].second;
}
vector<int> frame(m);
for (int i = 0; i < m; i++)
{
cin >> frame[i];
}
auto cmp = [&](pair<int, int> i, pair<int, int> j)
{
return make_pair(i.second, i.first) < make_pair(j.second, j.first);
};
sort(a.begin(), a.end(), cmp);
sort(frame.begin(), frame.end());
int ret = 0;
for (int i = n - 1, j = m - 1; i >= 0 && j >= 0; i--)
{
if (frame[j] >= a[i].first)
{
ret++;
j--;
}
}
cout << ret;
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... |