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>
//#ifndef ONLINE_JUDGE
//#include <debugging.h>
//#endif
#define ff first
#define ss second
#define pp push_back
#define all(x) (x).begin(),(x).end()
#define dbg(v) cout << "Line(" << __LINE__ << ") -> " << #v << " = " << (v) << endl;
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair <int,int>;
using pll = pair <ll,ll>;
using pld = pair <ld,ld>;
const char el ='\n';
const char sp = ' ';
const int maxn = 2e5+5, mod = 1e9+7, N = 10;
const ll inf = 1e18L+3;
int n,m,b[maxn],ans;
pii a[maxn];
void input()
{
cin>>n>>m;
for(int i=1;i<=n;++i) cin>>a[i].ss>>a[i].ff;
for(int i=1;i<=m;++i) cin>>b[i];
sort(a+1,a+n+1);
sort(b+1,b+m+1);
}
void solve()
{
for(int i=m,j=n;i>0;--i)
{
if(j<1) break;
while(j>0 && a[j].ss>b[i]) --j;
if(j>0)
{
++ans;
--j;
}
}
cout<<ans;
}
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int test = 1;
// cin>>test;
while(test-->0)
{
input();
solve();
}
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... |