分析:复杂的经营分部树. 只有一个查询操作,这是要求[l,r]的数量之间p钍总和.并不是所有的查询所有节点,会议TLE.最好的是查询部件[a.b].所有这个区间值我们是平等的,即能返回(b-a+1)*val 的值.区间内全部值都同样的情况的区间.对于置初值和加乘操作.分两种情况:1.当为置初值操作.直接覆盖区间就可以.并把标记的加乘操作赋为初始值.2.当为加乘操作时.先推断当前区间段是否为同样的值,是的话直接加乘,维护这个同样的值就可以.假设不同样,看区间是否已有加乘标记,把这个加乘标记一直传递…
6356.Glad You Came 题意就是给你一个随机生成函数,然后从随机函数里确定查询的左右区间以及要更新的val值.然后最后求一下异或和就可以了. 线段树,区间最大值和最小值维护一下,因为数据有点大,不剪枝就会超时.(默默吐槽,剪了枝照样超时) 因为太菜,交了24遍也是没过,TLE,WA,RE轮流来,而且感觉这题有毒,删一个没用的变量就会WA... 百度了一下题解,发现有人和我写的几乎一模一样,但是人家的就可以过,我的死也过不去. 人家的博客:HDU6356 Glad You Came(…
DZY Loves Sorting Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 753    Accepted Submission(s): 249 Problem Description DZY has a sequence a[1..n]. It is a permutation of integers 1∼n. Now h…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4578 Problem Description Yuanfang is puzzled with the question below: There are n integers, a1, a2, …, an. The initial values of them are 0. There are four kinds of operations.Operation 1: Add c to each…
http://acm.hdu.edu.cn/showproblem.php?pid=4578 题目大意:对于一个给定序列,序列内所有数的初始值为0,有4种操作.1:区间(x, y)内的所有数字全部加上C:2:区间(x, y)内所有数字全部乘C; 3:区间(x, y)内的所有数字全部重置为C: 4:输出区间(x, y)内所有数字的P次方的和.由于题目为多实例(至少10组样例),故很耿直的更新到叶子节点明显会TLE:因此需优化.可发现题目所有操作都是对区间进行,因此只需要更新 到区间内数字相同即可.…
Transformation Time Limit: 15000/8000 MS (Java/Others)    Memory Limit: 65535/65536 K (Java/Others)Total Submission(s): 3830    Accepted Submission(s): 940 Problem Description Yuanfang is puzzled with the question below: There are n integers, a1, a2,…
Transformation Time Limit: 15000/8000 MS (Java/Others)    Memory Limit: 65535/65536 K (Java/Others)Total Submission(s): 49    Accepted Submission(s): 16 Problem Description Yuanfang is puzzled with the question below: There are n integers, a1, a2, …,…
Problem Description In the game of DotA, Pudge's meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. Now Pudge wants to do some operations on t…
https://cn.vjudge.net/problem/HDU-4578 题意 4种操作,区间加,区间乘,区间变为一个数,求区间的和.平方和以及立方和. 分析 明显线段树,不过很麻烦..看kuangbin大神的代码打的 用sum1,sum2,sum3分别代表和.平方和.立方和. 懒惰标记使用三个变量: lazy1:是加的数 lazy2:是乘的倍数 lazy3:是赋值为一个常数,为0表示没有. #include <stdio.h> #include <string.h> #inc…
Transformation Time Limit: 15000/8000 MS (Java/Others)    Memory Limit: 65535/65536 K (Java/Others)Total Submission(s): 10082    Accepted Submission(s): 2609 Problem Description Yuanfang is puzzled with the question below: There are n integers, a1, a…