记录编号 | 295381 | 评测结果 | AAWWAWWWAW | ||
---|---|---|---|---|---|
题目名称 | 1212.[NOIP 2010冲刺十二]奶牛排队 | 最终得分 | 40 | ||
用户昵称 | 是否通过 | 未通过 | |||
代码语言 | C++ | 运行时间 | 0.219 s | ||
提交时间 | 2016-08-13 17:49:19 | 内存使用 | 0.53 MiB | ||
#include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int maxn=100010; int n,x,top=0,l,ans=0; pair<int,int>a[maxn]; int main(){ #define MINE #ifdef MINE freopen("tahort.in","r",stdin); freopen("tahort.out","w",stdout); #endif scanf("%d%d",&n,&x); a[++top]=make_pair(x,1); for(int i=2;i<=n;i++){ scanf("%d",&x); l=i; while(top&&a[top].first<=x)l=a[top--].second; ans=max(ans,i-l+1); a[++top]=make_pair(x,l); } printf("%d",ans); return 0; }