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 NDEBUG
#ifdef NDEBUG
#define dbg(TXTMSG) if constexpr (false) cerr << "lol"
#define dbgv(VARN) ((void)0)
#define dbgfor(COND) if constexpr (false) for (COND)
#else
#define _GLIBCXX_DEBUG 1
#define _GLIBCXX_DEBUG_PEDANTIC 1
#pragma GCC optimize("trapv")
#define dbg(TXTMSG) cerr << "\n" << TXTMSG
#define dbgv(VARN) cerr << "\n" << #VARN << " = "<< VARN << ", line " << __LINE__ << "\n"
#define dbgfor(COND) for (COND)
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
#define e0 first
#define e1 second
constexpr ll INFTY = 2e18;
int main()
{
ll N,M;
cin >> N >> M;
vector<pll> VS(N);
for (ll i = 0; i < N; ++i)
{
cin >> VS[i].e1 >> VS[i].e0;
}
vector<ll> C(M);
for (ll i = 0; i < M; ++i)
{
cin >> C[i];
}
sort(C.begin(),C.end());
sort(VS.begin(),VS.end());
ll currV=INFTY;
while (!VS.empty() && !C.empty())
{
auto [vi,si] = VS.back();
VS.pop_back();
if (si<=C.back() && vi<=currV)
{
C.pop_back();
currV=vi;
}
}
cout << M-ll(C.size());
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |