|
Online Judge |
Online Exercise |
Online Teaching |
Online Contests |
Exercise Author |
F.A.Q Hand In Hand Online Acmers Forum | Discuss Statistical Charts |
Problem Archive Realtime Judge Status Authors Ranklist |
C/C++/Java Exams ACM Steps Go to Job Contest LiveCast ICPC@China |
Best Coder beta VIP | STD Contests Virtual Contests DIY | Web-DIY beta Recent Contests |
lee
Mail 0(0)
Control Panel
Sign Out
|
|
即将截止!!!【BestCoder Round #3】8月3号19:00~21:00(赛前30分钟停止注册比赛) 不熟悉BestCoder的比赛?看看这里—>《BestCoder用户手册》下载链接
|
Level up Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3327 Accepted Submission(s): 907
Problem Description
Level up is the task of all online games. It's very boooooooooring. There is only level up in those games, except level up.
In a online game, there are N heroes numbered id from 1 to N, each begins with level 1 and 0 Experience. They need to kill monsters to get Exp and level up.
There are many waves of monsters, each wave, the heroes with id from li to ri will come to kill monsters and those hero with level k will get ei*k Exp. If one hero's Exp reach Needk then the hero level up to level k immediately.
After some waves, I will query the maximum Exp from li to ri.
Now giving the information of each wave and Needk, please tell me the answer of my query.
Input
The first line is a number T(1<=T<=30), represents the number of case. The next T blocks follow each indicates a case.
The first line of each case contains three integers N(1<=N<=10000), K(2<=K<=10) and QW(1<=QW<=10000)each represent hero number, the MAX level and querys/waves number.
Then a line with K -1 integers, Need2, Need3...Needk.(1 <= Need2 < Need3 < ... < Needk <= 10000).
Then QW lines follow, each line start with 'W' contains three integers li ri ei (1<=li<=ri<=N , 1<=ei<=10000); each line start with 'Q' contains two integers li ri (1<=li<=ri<=N).
Output
For each case, output the number of case in first line.(as shown in the sample output)
For each query, output the maximum Exp from li to ri.
Output a black line after each case.
Sample Input
2 3 3 5 1 2 W 1 1 1 W 1 2 1 Q 1 3 W 1 3 1 Q 1 3 5 5 8 2 10 15 16 W 5 5 9 W 3 4 5 W 1 1 2 W 2 3 2 Q 3 5 W 1 3 8 Q 1 2 Q 3 5
Sample Output
Case 1: 3 6 Case 2: 9 18 25
Hint
Case 1: At first ,the information of each hero is 0(1),0(1),0(1) [Exp(level)] After first wave, 1(2),0(1),0(1); After second wave, 3(3),1(2),0(1); After third wave, 6(3),3(3),1(2); Case 2: The information of each hero finally: 18(5) 18(5) 25(5) 5(2) 9(2)
Author
NotOnlySuccess
|
题意:有N个英雄,每个英雄的初始等级为1,初始经验为0,有K个等级,QW个操作。接下来一行中有K-1个数值,代表升到等级2,等级3……所要达到的经验。接下来的QW行里,每行是一个操作,操作有两类,(1)"l r e",代表区间[l,r]里的每个英雄将得到e乘以他的等级的经验。(2)"l r",表示查询区间[l,r]里经验最大值。
思路:线段树维护一个maxv(表示当前段最大值),level(表示当前段最大的level,用来更新maxv用的),cnt(延迟标记,记录当前段的经验值e),needv(表示到达下一阶段还需要的e)
#include
#include
#include
#include
#include
#include
#include
#include
在今年的多校联合也遇到了一个这样的题hdu4902和hdu4893,4893前面写过了,这里只写hdu4902
#include
#include
#include
#include
#include
#include
#include
#include