Submission #1237190

#TimeUsernameProblemLanguageResultExecution timeMemory
1237190nasjesExhibition (JOI19_ho_t2)C++20
100 / 100
105 ms2760 KiB
#include <iostream> #include <iomanip> #include <vector> #include <cmath> #include <algorithm> #include <set> #include <queue> #include <map> #include <stack> #include <bitset> #include <string> #include <cstring> #include <iterator> #include <random> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef long double ld; const ll dim = 5*1e6+7; //const ll mod = 1e9 + 7; const ll inf = 1e18 + 77; #define endl "\n" #define fi first #define pb push_back #define se second #define vll vector<ll> ll n, m; pll a[dim]; ll b[dim]; ll check(ll len){ ll p1=m-len+1; ll cnt=0; for(int i=1; i<=n; i++){ if(b[p1]>=a[i].se){ p1++; cnt++; } } if(cnt>=len)return 1; return 0; } int main() { ll k, s, t, u0, v0; cin>>n>>m; for(int i=1; i<=n; i++) { cin>>a[i].se>>a[i].fi; } sort(a+1, a+1+n); for(int i=1; i<=m; i++){ cin>>b[i]; } sort(b+1, b+1+m); ll l=0; ll r=min(n, m); while(r-l>=1){ ll mid=(l+r+1)/2; if(check(mid)){ l=mid; } else{ r=mid-1; } } cout<<l<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...