BZOJ 1113: Poi2008海报PLA(单调栈)
来源:互联网 发布:收购淘宝店铺可信吗 编辑:程序博客网 时间:2024/05/16 19:11
题目大意:用最少的纸张去覆盖矩形的楼。(此题与楼宽无关)
思路和上述几题差别不大。此题主要是排序后找相同高度。最后用总数减去即可。
#include<algorithm>#include<iostream>#include<cstring>#include<cstdio>#include<cstdlib>#include<string>#include<queue>#include<map>#include<stack>#define L1 long long#define L2 __int64#define inf 0x3f3f3f3fusing namespace std;const int m1=1001000;const int m2=1010;int head[m1],vex[m1],arr[m1];bool vis[m2][m2];int ans[110000];struct node{ int a,b,id; bool operator<(const node &p)const{ return a<p.a; }}q[100000];int main(){ int n,m,i,j,k; while(~scanf("%d",&n)) { for(i=1;i<=n;i++){ scanf("%d%d",&q[i].b,&q[i].a); q[i].id=i; } sort(q+1,q+n+1); stack<node>Q; Q.push(q[1]); long long ans=0; for(i=2;i<=n;i++){ while( !Q.empty()&&(Q.top().a==q[i].a) ) { node t=Q.top(); Q.pop(); ans++; } Q.push(q[i]); } printf("%lld\n",n-ans); } return 0;}
0 0
- BZOJ 1113 [Poi2008]海报PLA 单调栈
- [BZOJ 1113][Poi2008]海报PLA:单调栈
- BZOJ 1113: [Poi2008]海报PLA 单调栈
- BZOJ 1113 [Poi2008]海报PLA 单调栈
- BZOJ 1113: Poi2008海报PLA(单调栈)
- BZOJ 1113: [Poi2008]海报PLA 裸单调栈
- 1113: [Poi2008]海报PLA 单调栈
- [BZOJ1113][Poi2008]海报PLA(单调栈)
- [bzoj1113][POI2008]海报PLA(单调栈)
- bzoj1113 [Poi2008]海报PLA(单调栈)
- 【BZOJ 1113】 [Poi2008]海报PLA
- bzoj 1113: [Poi2008]海报PLA
- BZOJ 1113: [Poi2008]海报PLA
- [单调栈] BZOJ 1113 [Poi2008]海报PLA & BZOJ 1628 [Usaco2007 Demo]City skyline
- 【洛谷3467】[POI2008]海报PLA-Postering(单调栈)
- Bzoj1113:[Poi2008]海报PLA:贪心+单调栈
- bzoj1113[Poi2008]海报PLA 单调栈
- bzoj 1113: [Poi2008]海报PLA 分治
- BZOJ 3932 [CQOI2015]任务查询系统 可持久化线段树
- C++成员变量初始化
- CSS:position:fixed使用
- windows 下编译libuv
- 自定义封装进度提示框《MrLoadView》
- BZOJ 1113: Poi2008海报PLA(单调栈)
- iOS网络编程:一 、GET方式同步请求
- Spring中 <tx:advice/> 标签
- 黑马程序员_IO流的概述和字符流
- IP 组播
- 安装NumPy和SciPy
- Remove Element
- 如何搭建Python3.4+Selenium
- python爬虫写文件编码