bzoj1113
来源:互联网 发布:北京交通事故数据统计 编辑:程序博客网 时间:2024/05/03 11:57
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1113View Code
题解:单调栈
代码:
1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<algorithm> 5 #define maxn 250005 6 using namespace std; 7 int n; 8 int a[maxn],b[maxn],z[maxn]; 9 int main()10 {11 scanf("%d\n",&n);12 int mmax=0,top=0,ans=0;13 for (int i=1; i<=n; i++) scanf("%d%d",&a[i],&b[i]),mmax=max(mmax,b[i]);14 z[0]=0;15 for (int i=1; i<=n; i++)16 {17 while (z[top]>b[i]) top--;18 if (z[top]<b[i]) ans++;19 z[++top]=b[i];20 }21 printf("%d\n",ans);22 }
0 0
- bzoj1113
- 【bzoj1113】[Poi2008]海报PLA
- bzoj1113[Poi2008]海报PLA
- BZOJ1113【单调栈】
- bzoj1113【poi2008】海报PLA
- 【Poi2008】【BZOJ1113】海报PLA
- BZOJ1113 海报PLA
- bzoj1113: [Poi2008]海报PLA
- 【bzoj1113】 [Poi2008]海报PLA
- bzoj1113 [Poi2008]海报PLA
- 【单调栈】【bzoj1113】海报PLA
- Bzoj1113:[Poi2008]海报PLA:贪心+单调栈
- [BZOJ1113][Poi2008]海报PLA(单调栈)
- bzoj1113[Poi2008]海报PLA 单调栈
- [bzoj1113][POI2008]海报PLA(单调栈)
- bzoj1113 [Poi2008]海报PLA(单调栈)
- 显示栅格数据的渲染器
- Bzoj3473
- bzoj1396
- bzoj1121
- web项目中运用java jfreechart生成各种样式报表的教程demo代码下载
- bzoj1113
- Unity设计模式之-Unity3d游戏开发设计模式之子类沙盒模式
- bzoj2038
- bzoj3809
- bzoj3289
- bzoj3052
- bzoj2453
- poi2007
- bzoj1529: [POI2005]ska Piggy banks