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;
#define optimizar_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout.setf(ios::fixed);cout.precision(15);
#pragma GCC optimize("Ofast")
typedef long long ll;
int main()
{
ll n,m;
cin>>n>>m;
priority_queue<pair<ll,ll>> q1;
priority_queue<ll> q2;
for(int i=0; i<n; i++)
{
ll a,b;
cin>>a>>b;
q1.push({b,a});
}
for(int i=0; i<m; i++)
{
ll a;
cin>>a;
q2.push(a);
}
ll cont=0;
while(!q2.empty())
{
while(q1.top().second>q2.top()&&q1.size()>0)
{
q1.pop();
}
if(q1.size()!=0)
{
q1.pop();
cont++;
}
q2.pop();
}
cout<<cont;
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... |