题目链接:Magician 题意: 给你一个长度为n的序列v,你需要对这个序列进行m次操作,操作一共有两种,输入格式为 type a b 1.如果type==0,你就需要输出[a,b]区间内的美丽序列中所有元素的和,要使得这个值尽可能大 2.如果type==1,你就需要把a位置的元素值改为b 区间[a,b]的美丽序列就是va,va+1...vb.你需要从中取出任意个元素,这些元素的位置必须是奇偶交替 例如给你一个序列1,2,3,4,5,6,7 你取出来的美丽序列就有可能使1,2,3,4,5,6,…
链接:http://acm.hdu.edu.cn/showproblem.php? pid=5316 Magician Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 190    Accepted Submission(s): 54 Problem Description Fantasy magicians usually gain…
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5475 Problem Description One day, a useless calculator was being built by Kuros. Let's assume that number X is showed on the screen of calculator. At first, X = 1. This calculator only supports two types…
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 th…
题意:有N个学生M条操作,0<N<=200000,0<M<5000,要么查询某区间内学生的最高分,要么更改某学生的成绩. 分析:原理和线段树点修改求和类似. #include<cstdio> #include<map> #include<iostream> #include<cstring> using namespace std; const int MAXN = 200000 + 10; int a[MAXN]; int ma[M…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1754 I Hate It Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 51917    Accepted Submission(s): 20381 Problem Description 很多学校流行一种比较的习惯.老师们很喜欢询问,从某…
线段树的修改 对于一棵 最大线段树, 每个节点包含一个额外的 max 属性,用于存储该节点所代表区间的最大值. 设计一个 modify 的方法,接受三个参数 root. index 和 value.该方法将 root 为跟的线段树中 [start, end] = [index, index] 的节点修改为了新的 value ,并确保在修改后,线段树的每个节点的 max属性仍然具有正确的值. 对于线段树: [1, 4, max=3] / \ [1, 2, max=2] [3, 4, max=3]…
Attack Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 2496    Accepted Submission(s): 788 Problem Description Today is the 10th Annual of “September 11 attacks”, the Al Qaeda is about to attack…
Coder Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4838    Accepted Submission(s): 1853 Problem Description In mathematics and computer science, an algorithm describes a set of procedures…
Man Down Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2030    Accepted Submission(s): 743 Problem Description The Game “Man Down 100 floors” is an famous and interesting game.You can enjoy t…