Submission #724541

#TimeUsernameProblemLanguageResultExecution timeMemory
724541fdnfksdExhibition (JOI19_ho_t2)C++14
100 / 100
54 ms4868 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...