当前位置: 首页 > news >正文

网页游戏网站建设网络搭建及应用技能大赛 试题与答案

网页游戏网站建设,网络搭建及应用技能大赛 试题与答案,专业酒店建设信息网站,山西国人伟业网站传送门 文章目录题意#xff1a;思路#xff1a;题意#xff1a; 思路#xff1a; 首先一个括号序列合法的条件可以转化成两个(左括号代价为111#xff0c;右括号代价为−1-1−1)#xff1a; (1) 左括号个数等于右括号个数。 (2) 括号的前缀和非负。 所以我们直接用线段…传送门 文章目录题意思路题意 思路 首先一个括号序列合法的条件可以转化成两个(左括号代价为111右括号代价为−1-1−1) (1) 左括号个数等于右括号个数。 (2) 括号的前缀和非负。 所以我们直接用线段树维护一个前缀和序列维护一下最小值即可。要输出的最大嵌套数就是前缀和的最大值再维护一个最大值即可。 //#pragma GCC optimize(2) #includecstdio #includeiostream #includestring #includecstring #includemap #includecmath #includecctype #includevector #includeset #includequeue #includealgorithm #includesstream #includectime #includecstdlib #define X first #define Y second #define L (u1) #define R (u1|1) #define pb push_back #define mk make_pair #define Mid (tr[u].ltr[u].r1) #define Len(u) (tr[u].r-tr[u].l1) #define random(a,b) ((a)rand()%((b)-(a)1)) #define db puts(---) using namespace std;//void rd_cre() { freopen(d://dp//data.txt,w,stdout); srand(time(NULL)); } //void rd_ac() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//AC.txt,w,stdout); } //void rd_wa() { freopen(d://dp//data.txt,r,stdin); freopen(d://dp//WA.txt,w,stdout); }typedef long long LL; typedef unsigned long long ULL; typedef pairint,int PII;const int N1000010,mod1e97,INF0x3f3f3f3f; const double eps1e-6;int n; char s[N],a[N]; struct Node {int l,r;int sum,lazy;int mx,mi; }tr[N2];void pushup(int u) {tr[u].sumtr[L].sumtr[R].sum;tr[u].mxmax(tr[L].mx,tr[R].mx);tr[u].mimin(tr[L].mi,tr[R].mi); }void pushdown(int u) {if(tr[u].lazy){int lazytr[u].lazy; tr[u].lazy0;tr[L].lazylazy; tr[R].lazylazy;tr[L].milazy,tr[L].mxlazy;tr[R].milazy,tr[R].mxlazy;} }void build(int u,int l,int r) {tr[u]{l,r};tr[u].mi0; tr[u].mx0;if(lr) return;build(L,l,Mid); build(R,Mid1,r); }void modify(int u,int l,int r,int x) {if(tr[u].lltr[u].rr){tr[u].lazyx;tr[u].mix,tr[u].mxx;return;}pushdown(u);if(lMid) modify(L,l,r,x);if(rMid) modify(R,l,r,x);pushup(u); }int main() { // ios::sync_with_stdio(false); // cin.tie(0);scanf(%d%s,n,s1);build(1,1,n1);int pos1,cnt10,cnt20;for(int i1;in;i){if(s[i]R) pos;else if(s[i]L) posmax(1,pos-1);else if(s[i](){if(a[pos]!(){if(a[pos])) modify(1,pos,n1,2),cnt1,cnt2--;else modify(1,pos,n1,1),cnt1;a[pos](;}}else if(s[i])){if(a[pos]!)){if(a[pos]() modify(1,pos,n1,-2),cnt1--,cnt2;else modify(1,pos,n1,-1),cnt2;a[pos]);}}else{if(a[pos])) modify(1,pos,n1,1),cnt2--;else if(a[pos]() modify(1,pos,n1,-1),cnt1--;a[pos]s[i];}if(cnt1!cnt2||tr[1].mi0) printf(-1 );else printf(%d ,tr[1].mx);}return 0; } /**/
http://www.pierceye.com/news/335686/

相关文章:

  • 如何仿制一个网站注册商标设计
  • 网站建设属于什么岗位旅游网站设计模板
  • 自己做的网站怎么链接火车头采集软件开发模型是什么
  • 新网站怎么做才会被收录正品海外购网站有哪些
  • 广东手机网站建设品牌js制作网页计算器
  • 化隆网站建设公司学做网站多久
  • 网站域名如何查询上海室内设计公司哪家好
  • 电子书推送网站怎么做新做的网站如何
  • 网站建设图片怎么加水印电商平台网站建设功能介绍
  • 一个门户网站怎么做金坛网站建设哪家好
  • 大学网站建设图江苏廉政建设网站
  • 班级网站建设方案网页美工的设计要点
  • 微网站搭建流程做网站的广告语
  • 那个网站做外贸canvas做的网站
  • 学做视频的网站wordpress上传大附件
  • 怎么做网站卖产品黄埭网站建设
  • 娱乐网站 建站软件学校网站建设栏目
  • 做调研有哪些网站网站建设策划书
  • 旺道网站排名优化建设网站需要做的工作
  • 设计公司网站 唐山本地备份wordpress
  • 淘宝客网站建设多少钱app网站开发案例
  • vs2008不能新建网站个性手绘个人网站模板下载
  • 西安好的网站建设公司西安高端网站制作公司哪家好
  • 网站分享按钮网站运营建站优化专家
  • 网站微信建设运维经验分享用cms创建自己带数据库的网站和在本机搭建网站运行平台的心得体会
  • wordpress建站吧做网站接专线费用
  • c 做网站设计广东seo点击排名软件哪里好
  • 微网站微网站seo服务理念
  • 建设网站招聘商标注册查询官网网站
  • 建设彩票网站合法吗新浪sae 搭建wordpress