【BZOJ 1012】 [JSOI2008]最大数maxnumber
来源:互联网 发布:淘宝如何设置冰点促销 编辑:程序博客网 时间:2024/06/06 00:05
以前看过这个题 这次一遍A 真舒服
留下最大值 每次二分就行
#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>#define LL long longusing namespace std;LL a[200000+1],b[200000+1];LL n,MO;LL tot=1;int main(){// fre0open("a.in","r",stdin); cin>>n>>MO;LL tmp=0; int cnt=0; for(int i=1;i<=n;i++) { char c;getchar();c=getchar(); if(c=='A') { LL x;scanf("%lld",&x);x+=tmp;x%=MO; while(a[tot]<=x&&tot>0) tot--; a[++tot]=x; b[tot]=++cnt; } else { LL x;scanf("%d",&x); x=cnt-x+1;//cout<<a[1]<<' '<<a[2]<<endl; int L=1,R=tot; while(L<R) { int mid=(L+R)/2; if(b[mid]<x) L=mid+1; else R=mid; } tmp=a[L]; printf("%lld\n",tmp); } } return 0;}
0 0
- BZOJ 1012: [JSOI2008]最大数maxnumber
- BZOJ 1012 [JSOI2008]最大数maxnumber
- BZOJ 1012: [JSOI2008]最大数maxnumber
- [BZOJ 1012][JSOI2008]最大数maxnumber
- BZOJ 1012: [JSOI2008]最大数maxnumber
- bzoj 1012: [JSOI2008]最大数maxnumber 二分
- bzoj 1012 [JSOI2008]最大数maxnumber
- [BZOJ 1012] [JSOI2008] 最大数maxnumber
- 【BZOJ 1012】[JSOI2008]最大数maxnumber
- BZOJ 1012:[JSOI2008]最大数 maxnumber
- bzoj 1012 [JSOI2008]最大数maxnumber
- 【BZOJ 1012】 [JSOI2008]最大数maxnumber
- bzoj 1012 [JSOI2008]最大数maxnumber
- BZOJ 1012 [JSOI2008]最大数maxnumber
- BZOJ 1012 [JSOI2008]最大数maxnumber
- BZOJ 1012: [JSOI2008]最大数maxnumber
- BZOJ 1012: [JSOI2008]最大数maxnumber
- bzoj 1012: [JSOI2008]最大数maxnumber
- basler 相机使用出现的问题
- 【洛谷 1991】 无线通讯网
- 【CodeVS 1540】银河英雄传说 2002年NOI全国竞赛
- 【BZOJ 1798】[Ahoi2009]Seq 维护序列seq
- 【洛谷 2161】 [Shoi2009]Booking 会场预约
- 【BZOJ 1012】 [JSOI2008]最大数maxnumber
- 【洛谷 1357】 花园
- 【洛谷 1338】 末日的传说
- 【BZOJ 1856】 [Scoi2010]字符串
- 【FZUOJ 2020】 组合
- 【BZOJ 3191】[JLOI2013]卡牌游戏
- 【BZOJ 1088】 [SCOI2005]扫雷Mine
- 理解tcp关闭连接中的time_wait状态
- 【BZOJ 1257】 [CQOI2007]余数之和sum