hdu5828 Rikka with Sequence】的更多相关文章

分析:这个题和bc round 73应该是差不多的题,当时是zimpha巨出的,那个是取phi,这个是开根 吐槽:赛场上写的时候直接维护数值相同的区间,然后1A,结果赛后糖教一组数据给hack了,仰慕 由于是开根,所以存在两个数刚开始差为1,加上某数再开根依旧是差1,这样维护相同数区间的就没用了 比如(2,3) +6-->(8,9)开根-->(2,3)如果全是这样的操作,即使维护相同的数,每次开根的复杂度都是O(N),不T才怪 这样只需要维护区间最大值最小值,当差1的时候,看看是否开根后还是差…
传送门 这道题维护区间加,区间开根,区间求和. 线段树常规操作. 首先回忆两道简单得多的线段树. 第一个:区间覆盖,区间加,区间求和. 第二个:区间开根,区间求和. 这两个是名副其实的常规操作. 但这道题如果学习没有区间加的做法维护最大值很容易卡掉. 所以怎么做呢? 区间加和区间求和就略了. 考虑到开根的性质,显然一段区间的数多开几次根差就不大了. 这样的话,我们维护区间最大值和区间最小值,如果当前区间的最大值与最小值的差不大于1的话就直接进行开根操作,否则继续递归. 开根时要分类讨论. 我们令…
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=5828 [题解] 考虑bzoj3211 花神游历各国,只是多了区间加操作. 考虑上题写法,区间全为1打标记.考虑推广到这题:如果一个区间max开根和min开根相同,区间覆盖标记. 巧的是,这样复杂度是错的! e.g: $n = 10^5, m = 10^5$ $a[] = \{1, 2, 1, 2, ... , 1, 2\}$ $operation = \{ "1~1~n~2", "…
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…
// 判断相同区间(lazy) 多校8 HDU 5828 Rikka with Sequence // 题意:三种操作,1增加值,2开根,3求和 // 思路:这题与HDU 4027 和HDU 5634 差不多 // 注意开根号的话,遇到极差等于1的,开根号以后有可能还是差1.如 // 2 3 2 3... // 8 9 8 9... // 2 3 2 3... // 8 9 8 9... // 剩下就是遇到区间相等的话,就直接开根号不往下传 #include <bits/stdc++.h> u…
Rikka with Sequence 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5828 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 wi…
Rikka with Sequence 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5828 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 wi…
Rikka with sequence Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5204 Description 众所周知,萌萌哒六花不擅长数学,所以勇太给了她一些数学问题做练习,其中有一道是这样的:现在有一个序列,因为这个序列很任性,开始时空的.接下来发生了n个事件,每一个事件是以下两种之一:1.勇太利用黑炎龙的力量在序列的开头.结尾以及每相邻两个元素之间都插入…
Rikka with Sequence Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2777    Accepted Submission(s): 503 Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situati…
Problem DescriptionAs 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 makes m operations on it. There are three ty…