比赛 |
2019.3.13 |
评测结果 |
AAAAAAAAAA |
题目名称 |
梦境 |
最终得分 |
100 |
用户昵称 |
梦那边的美好ET |
运行时间 |
1.151 s |
代码语言 |
C++ |
内存使用 |
15.95 MiB |
提交时间 |
2019-05-06 21:33:48 |
显示代码纯文本
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<queue>
#define maxn 200010
using namespace std;
priority_queue<int>q;
int n,m,z[maxn],ans,ld=1;
struct hs{int x,y;}a[maxn];
bool bk(hs a1,hs a2){return a1.x<a2.x;}
int main(){
freopen("dream.in","r",stdin);
freopen("dream.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)scanf("%d%d",&a[i].x,&a[i].y);
for(int i=1;i<=m;i++)scanf("%d",&z[i]);
sort(a+1,a+1+n,bk);sort(z+1,z+1+m);
for(int i=1;i<=m;i++){
while(ld<=n&&a[ld].x<=z[i])q.push(-a[ld].y),ld++;
while(q.size()){
if(-q.top()<z[i])q.pop();
else break;
}
if(q.size())ans++,q.pop();
}
printf("%d\n",ans);
return 0;
}