hdu4268Alice and Bob(multise)
来源:互联网 发布:一个能看网络攻击网站 编辑:程序博客网 时间:2024/06/05 04:02
题目链接:点击打开链接
#include<stdio.h>
#include<set>
#include<algorithm>
#define LL long long
using namespace std;
struct node{
LL h;
LL w;
}a[100100],b[100100];
bool cmp(node aa,node bb)
{
return aa.w<bb.w;
}
multiset<LL>ms;
multiset<LL>::iterator it;
int main()
{
int t,n,i,j,s;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%lld%lld",&a[i].h,&a[i].w);
sort(a,a+n,cmp);
for(i=0;i<n;i++)
scanf("%lld%lld",&b[i].h,&b[i].w);
sort(b,b+n,cmp);
s=0;
ms.clear();
for(i=0,j=0;i<n;i++)
{
for(;j<n&&a[i].w>=b[j].w;j++)
ms.insert(b[j].h);
if(ms.empty())
continue;
it=ms.lower_bound(a[i].h);
if(it==ms.end()||*it>a[i].h)
it--;
if(*it<=a[i].h)
{
s++;
ms.erase(it);
}
}
printf("%d\n",s);
}
return 0;
}
0 0
- hdu4268Alice and Bob(multise)
- hdu4268Alice and Bob 贪心+multiset
- Alice and Bob(长春)
- SDUT2608(Alice and Bob)
- Alice and Bob(博弈)
- poj 1704 Georgia and Bob(博弈)
- ZOJ 3666 Alice and Bob(博弈)
- HDU 4268 Alice and Bob(贪心)
- ACdream群赛1112(Alice and Bob)
- Georgia and Bob(尼姆博弈)
- HDU 4268 Alice and Bob(贪心)
- HDU 4268 Alice and Bob (贪心)
- hdu 4268 Alice and Bob(multiset)
- HDU 5054 Alice and Bob(数学)
- [5055]Bob and math problem(hdu)
- POJ1704 Georgia and Bob(Nim问题)
- POJ 1704 Georgia and Bob(博弈)
- XTU 1209 Alice and Bob (博弈)
- 系统dos命令
- 字符串的排列
- Android开发中的MVP简介(一)
- springMVC和struts2的区别
- [计算机领域的思维导图系列整理][java]多线程
- hdu4268Alice and Bob(multise)
- knockout + require + director 构建单页面程序(director)
- C++对象模型Data语意学分析、虚继承底层实现机制
- java基础 课后错题集(1)
- 自定义ScrollView下拉头部变大,弹性动画缩回原型
- 手把手教你使用Git
- Struts2
- MySQL(3):CRUD语句(1)——增、删、改
- Python3 基础:高级特性-列表生成式和生成器