제출 #221839

#제출 시각아이디문제언어결과실행 시간메모리
221839jiahngExhibition (JOI19_ho_t2)C++14
100 / 100
75 ms6640 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <ll> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
#define maxn 100001
#define int ll
int B[maxn];
pi A[maxn];
int N,M;
int32_t main(){
	fast;
	
	cin>>N>>M;
	
	priority_queue <int> pq;
	
	FOR(i,0,N-1) cin>>A[i].s>>A[i].f;
	FOR(i,0,M-1){
		int a;
		cin>>a;
		pq.push(a);
	}
	
	sort(A,A+N,greater<pi>());
	
	sort(B,B+N,greater<int>());
	int ans = 0;
	
	FOR(i,0,N-1){
		if (!pq.empty() && pq.top() >= A[i].s){
			ans++;
			pq.pop();
		}
	}
	
	cout<<ans;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...