This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*DavitMarg*/
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <stack>
#include <cassert>
#include <iterator>
#include <fstream>
#define mod 1000000007ll
#define LL long long
#define LD long double
#define MP make_pair
#define PB push_back
#define all(v) v.begin(), v.end()
#define fastIO ios::sync_with_stdio(false); cin.tie(0)
using namespace std;
const int N = 100005;
int n, k, c[N],ans;
pair<int, int> a[N];
int main()
{
fastIO;
cin >> n >> k;
for (int i = 1; i <= n; i++)
cin >> a[i].first >> a[i].second;
for (int i = 1; i <= k; i++)
cin >> c[i];
sort(c + 1, c + 1 + k);
sort(a + 1, a + 1 + n, [](pair<int, int> a, pair<int, int> b) {
if (a.second != b.second)
return a.second < b.second;
return a < b;
});
for (int i = n; i >= 1; i--)
{
if (c[k] < a[i].first)
continue;
int x = lower_bound(c + 1, c + 1 + k, a[i].first) - c;
if (k - x >= ans)
ans++;
}
cout << ans << endl;
return 0;
}
/*
4 3
1 1
1 1
2 0
2 2
1
1
2
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |