比赛 |
2019.3.13 |
评测结果 |
AAAWWWWTTT |
题目名称 |
梦境 |
最终得分 |
30 |
用户昵称 |
瑆の時間~無盡輪迴·林蔭 |
运行时间 |
3.000 s |
代码语言 |
C++ |
内存使用 |
4.78 MiB |
提交时间 |
2019-05-06 21:04:53 |
显示代码纯文本
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
struct xs
{
int l,r;
};
xs we[200001];
int p[200001];
int n,m,ans=0,head=1;
bool cmp1(xs a,xs b)
{
if(a.l==b.l)
return a.r<b.r;
return a.l<b.l;
}
bool cmp2(int a,int b)
{
return a<b;
}
int LINYIN()
{
freopen("dream.in","r",stdin);
freopen("dream.out","w",stdout);
scanf("%d%d",&n,&m);
for(register int i=1;i<=n;i++)
{
scanf("%d%d",&we[i].l,&we[i].r);
}
for(register int i=1;i<=m;i++)
{
scanf("%d",&p[i]);
}
sort(we+1,we+1+n,cmp1);
sort(p+1,p+1+m,cmp2);
for(register int i=1;i<=n;i++)
{
for(register int j=head;j<=m;j++)
{
if(we[i].l<=p[j]&&we[i].r>=p[j])
{
head=j+1;
ans++;
break;
}
}
}
printf("%d",ans);
return 0;
}
int sdw=LINYIN();
int main()
{
;
}