2016暑假多校联合---Rikka with Sequence (线段树) Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: Yuta has an array A with n numbers. Then he make…
Wow! Such Sequence! Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 3808 Accepted Submission(s): 1079 Problem Description Recently, Doge got a funny birthday present from his new friend, Protein…
题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=6047 题目: Maximum Sequence Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 90    Accepted Submission(s): 44 Problem Description Steph is extremely o…
At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important things were lost, in particular the favorite sequence of Picks. Fortunately, Picks remembers how to repair the sequence. Initi…
正赛的时候完全没看这个题,事后winterzz告诉我他想出来的解法. 首先题意是给出n个点,m次操作. 操作有一种是连接两个点,另一种是求此时再为这个图连k条边,最少和最多能有几个联通块. 最少的求法很简单,显然一条边可以减少一个联通块. 最多的求法则稍微复杂: 首先我们先将所有联通块填成完全图,这部分边是白给的. 接下来最优的连接方式显然是将最大的和次大的联通块合并,如果还有边需要连就再将其把第三大的联通块合并...一直这样下去. 这个东西我们显然可以二分,二分出将多少个联通块合并成一起能用完…
题目链接:Codeforces 486E LIS of Sequence 题目大意:给定一个数组.如今要确定每一个位置上的数属于哪一种类型. 解题思路:先求出每一个位置选的情况下的最长LIS,由于開始的想法,所以求LIS直接用线段树写了,没有改,能够用 log(n)的算法直接求也是能够的.然后在从后向前做一次类似LIS.每次推断A[i]是否小于f[dp[i]+1],这样就能够确定该位 置是否属于LIS序列. 然后为第三类的则说明dp[i] = k的仅仅有一个满足. #include <cstdi…
Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= 1000, N <= 1000). K superhighways will be build. Cities on eac…
http://www.lydsy.com:808/JudgeOnline/problem.php?id=3038 这题我就有得吐槽了,先是线段树更新写错,然后不知哪没pushup导致te,精度问题sqrt没有开ll又wa,最终..才acTAT,我容易吗我?第一次a后我测试了,还真是sqrt精度和flag问题TAT 这题更新sqrt暴力更新就行了,只需要注意,当sum=1或sum=0时就不必向下更新了,,这是一个小小的优化 #include <cstdio> #include <cstri…
D. The Child and Sequence Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/438/problem/D Description At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important…
/* 区间修改 区间查询 可以用线段树搞 但是一般的标记下放对这个题好像不合适 只能改叶子 然后更新父亲(虽然跑的有点慢) 小优化:如果某个点是1 就不用再开方了 所以搞一个f[i]标记 i 这个点还需不需要处理下去 注意用longlong 还有就是数组开大 */ #include<iostream> #include<cstdio> #include<cmath> #include<cstring> #define LL long long #define…