Submission #166090

#TimeUsernameProblemLanguageResultExecution timeMemory
166090davooddkareshkiExhibition (JOI19_ho_t2)C++17
0 / 100
3 ms380 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define F first #define S second #define int long long const int maxn = 1e6+10; const int mod = 1e9+7; int n, m; vector<pair<int,int>> v; int s[maxn]; bool ok(int k) { if(k > n || k > m) return 0; vector<pair<int,int>> ve; for(int i = 0; i < k; i++) ve.push_back({v[i].S,v[i].F}); sort(ve.begin(),ve.end()); vector<int> v1; for(int i = m-k; i < m; i++) v1.push_back(s[i]); for(int i = 0; i < k; i++) if(ve[i].S > v1[i]) return 0; return 1; } signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>> n >> m; for(int i = 0; i < n; i++){ int a, b; cin>> a >> b; v.push_back({a,b}); } sort(v.begin(),v.end()); for(int i = 0; i < m; i++) cin>> s[i]; sort(s,s+m); int hi = n+1, lo = 0; while(hi-lo > 1) { int tm = (hi+lo)/2; if(ok(tm)) lo = tm; else hi = tm; } cout<< lo; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...