Gorgeous Sequence Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 349    Accepted Submission(s): 57 Problem Description There is a sequence a of length n. We use ai to denote the i-th element…
Easy Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 766    Accepted Submission(s): 208 Problem Descriptionsoda has a string containing only two characters -- '(' and ')'. For every c…
Gorgeous Sequence Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 2150    Accepted Submission(s): 594 Problem Description There is a sequence a of length n. We use ai to denote the i-th elemen…
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5860 题目大意:给你n个人排成一列编号,每次杀第一个人第i×k+1个人一直杀到没的杀.然后剩下的人重新编号从1-剩余的人数.按照上面的方式杀.问第几次杀的是谁. 分析 一轮过后和原来问题比只是人的编号发生变化,故可以转化为子问题求解,不妨设这n个人的编号是0~n-1,对于第i个人,如果i%k=0,那么这个人一定是第一轮出列的第i/k+1个人:如果i%k!=0,那么这个人下一轮的编号就是i…
如果维护max,sum,那么可以得到一个暴力方法,如果t>=max,那可以return,否则往下更新,显然超时. 在上面基础上,再维护一下次大值,与最大值的个数.这样一来,次大值<t<最大值 这样的情况也可以更新完了之后直接return,pushDown的话也很好操作. 实践证明,这样的复杂度降到了nlog(n),具体证明可以看吉如一论文. #pragma comment(linker, "/STACK:1024000000,1024000000") #include…
题解: 线段树维护区间取min求和求max 维护最小值以及个数,次小值 标记清除时,分情况讨论 当lazy>max1 退出 当max1>lazy>max2(注意不要有等号) 更新 否则递归处理 据吉如一的论文上说是nlogn的复杂度(至今不知论文在何处) 卡常?? 不懂常熟技巧 那就开个o2水一下.... 这数的大小 正好2^31 刚开始没看..对拍挺对交上去wa了 #pragma G++ optimize (2) #include <bits/stdc++.h> using…
题目链接 吉司机线段树裸题... #include<bits/stdc++.h> using namespace std; typedef long long ll; ,inf=0x3f3f3f3f3f3f3f3f; ll n,m,a[N],mx[N<<],se[N<<],nmx[N<<],lz[N<<]; ll sum[N<<]; #define ls (u<<1) #define rs (u<<1|1) #…
Code: #include<algorithm> #include<cstdio> #include<cstring> #define ll long long #define setIO(s) freopen(s".in","r",stdin) #define maxn 2000000 #define lson (now<<1) #define rson ((now<<1)|1) using names…
tree Time Limit: 8000ms Memory Limit: 262144KB This problem will be judged on HDU. Original ID: 539064-bit integer IO format: %I64d      Java class name: Main   Given a rooted tree(node 1 is the root) with n nodes. The ithnode has a positive value vi…
Yu-Gi-Oh! Time Limit: 2000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ID: 538364-bit integer IO format: %I64d      Java class name: Main   "Yu-Gi-Oh!", also known as "Dueling Monsters", is a popular trading ca…