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;
const int mod=1e9+7;
int n,m,ans;
vector<pair<int,int> >a;
vector<int>b;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen("dec.in","r",stdin);
//freopen("dec.out","w",stdout);
cin>>n>>m;
for(int i=0;i<n;i++)
{
int x,y;
cin>>x>>y;
a.push_back({y,x});
}
for(int i=0;i<m;i++)
{
int x;
cin>>x;
b.push_back(x);
}
sort(a.rbegin(),a.rend());
sort(b.rbegin(),b.rend());
int j=0;
for(int i=0;i<m;i++)
{
if(j<n)
{
while(a[j].second>b[i])
{
j++;
if(j==n)break;
}
}
if(j==n)break;
ans++;
j++;
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |