Submission #118264

#TimeUsernameProblemLanguageResultExecution timeMemory
118264Charis02Exhibition (JOI19_ho_t2)C++14
100 / 100
63 ms5752 KiB
#include<iostream> #include<stdio.h> #include<vector> #include<cmath> #include<queue> #include<string.h> #include<map> #include<set> #include<algorithm> #define ll long long #define pi pair < ll,ll > #define mp(a,b) make_pair(a,b) #define rep(i,a,b) for(int i = a;i < b;i++) #define N 300004 #define INF 1e9+7 using namespace std; ll n,m,cost[N]; pi ar[N]; bool check(ll k) { ll frame = m-k; rep(i,0,n) { if(ar[i].second <= cost[frame]) frame++; if(frame == m) return true; } return false; } int main() { ios_base::sync_with_stdio(false); cin >> n >> m; rep(i,0,n) { cin >> ar[i].second >> ar[i].first; } rep(i,0,m) { cin >> cost[i]; } sort(ar,ar+n); sort(cost,cost+m); ll low = 0; ll high = min(n,m); ll res = 0; while(low <= high) { ll mid= (low+high)/2; if(check(mid)) { low = mid+1; res = mid; } else { high= mid-1; } } cout << res; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...