This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <string>
#include <sstream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <stack>
#include <cstdio>
#include <climits>
#include <tuple>
#include <ctime>
#include <cstring>
#include <numeric>
#include <functional>
#include <chrono>
#include <cassert>
#include <bitset>
//#include <bit>
//#include <ranges>
//#include <numbers>
#define itn int
#define sacnf scanf
#define sz(a) ((int)((a).size()))
// printf("%.10f\n", ans);
using ll = long long;
using namespace std;
const ll mod = 998244353;
const int N = 1e6 + 1, inf = 1e9;
bool comp(pair<int, int>& a, pair<int, int>& b)
{
return (a.second != b.second) ? (a.second < b.second) : (a.first > b.first);
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
vector<pair<int, int>> vp(n);
for (int i = 0; i < n; i++) cin >> vp[i].first >> vp[i].second;
sort(vp.begin(), vp.end(), comp);
vector<int> c(m);
for (int i = 0; i < m; i++) cin >> c[i];
sort(c.begin(), c.end());
int ans = 0;
for (int i = n - 1; i >= 0; i--)
{
if (c.back() >= vp[i].first)
{
c.pop_back();
ans++;
if (c.empty()) break;
}
}
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... |