当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5140:Hun Gui Wei Company

题目描述
My friend Hun Gui Wei (HGW) has started a company which is named Hun Gui Wei Company (HGWC). In HGWC, there are many staffs. Every staff has a certain salary, level and working age. Sometimes, HGW wants to do some queries. He wants to know the sum of salary of the staffs fit some conditions. For the large amount of staffs, artificial query is time-consuming. So he wants to hire you to write a program to help him. If you do a good job, he will pay you a generous remuneration.
输入解释
Multi test cases (about 10).
The first line contains an integer n indicates there are n staffs in HGWC.
In the next n lines, each line describes the attributes of one staff.
Each line contains S, L, A indicate the salary, level and working age of one staff.
Next line an integer m comes which indicates there will be m queries.
Then next m lines, query dates will come
$\begin{matrix}
LL_0 & HL_0 & LA_0 & HA_0 \\
LL_1 & HL_1 & LA_1 & HA_1 \\
\vdots & \vdots & \vdots & \vdots \\
LL_{m-1} & HL_{m-1} & LA_{m-1} & HA_{m-1}
\end{matrix}$
HGW sets a variable k. In the beginning of each test case, k = 0. For the i-th query, he sets
$LL_i = LL_i + k, HL_i = HL_i - k, LA_i = LA_i + k, HA_i = HA_i - k$, then make k the answer of this query.

[Technical Specification]
All numbers in the input are integers.
$1 \leq n, m \leq 10^5$
$0 \leq S, L, A \leq 10^9$
$-10^{17} \leq LL_i, HL_i, LA_i, HA_i \leq 10^{17}$
输出解释
For i-th query,output the sum of salary of the staffs whose level are between $LL_i$ and $HL_i$ while working age are between $LA_i$ and $HA_i$ in a single line.
输入样例
2
1 2 3
4 5 6
2
3 2 3 3
2 6 2 7
输出样例
1
4
提示
For this case, first we clear k i.e. set k to 0. For the first query we should find the staff whose level is between 2 and 3 while working age is exactly 3. There is only one staff fitting the conditions whose salary is 1. So the answer for the first query is 1. Then we set k to 1. For the second query we should update query parameters according to the statement. Thus after updating, the query parameters become 3 5 3 6. There is also only one staff fitting the condition whose salary is 4. So the answer for the second case is 4.
来自杭电HDUOJ的附加信息
Recommend heyang

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 BestCoder Round #21

源链接: HDU-5140

最后修改于 2020-10-25T23:20:08+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
8000/4000MS(Java/Others) 131072/131072K(Java/Others)