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>
#define TASKNAME "codeforce"
#define pb push_back
#define pli pair<int,int>
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
const ll maxN=2e5;
const ll inf=1e18;
const ll mod=1e9+7;
ll n,m;
pli a[maxN];
ll b[maxN];
void solve()
{
cin >> n >> m;
for(int i=1;i<=n;i++) cin >> a[i].se >> a[i].fi;
sort(a+1,a+n+1);
for(int i=1;i<=m;i++)
{
cin >> b[i];
}
sort(b+1,b+m+1);
ll low=0,high=m;
while(low<=high)
{
ll mid=low+high>>1;
ll j=m-mid+1;
for(int i=1;i<=n;i++)
{
if(j<=m&&a[i].se<=b[j])
{
j++;
}
}
if(j==m+1) low=mid+1;
else high=mid-1;
}
cout << high;
}
int main()
{
fastio
//freopen(TASKNAME".INP","r",stdin);
//freopen(TASKNAME".OUT","w",stdout);
solve();
}
Compilation message (stderr)
joi2019_ho_t2.cpp: In function 'void solve()':
joi2019_ho_t2.cpp:29:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
29 | ll mid=low+high>>1;
| ~~~^~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |