-->
当前位置:首页 > 题库

PROGRAMMING:Eat beans

Luz5年前 (2021-05-10)题库449
As we all know, $$YP $$often doesn't eat, but $$YP $$likes to eat beans very much. He often eats a lot of beans, so $$YP $$won't feel hungry, so he doesn't want to eat
Now $$YP $$has a chessboard with $$n * m $$grids. The grid coordinates of the lower left corner are $$(1,1) $$, and the grid coordinates of the upper right corner are $$(n, m) $$. Each grid of the chessboard can hold any number of beans
At this time, DH came over with a bag of beans, intending to share the beans with $$YP $$, but $$DH $$didn't want to let $$YP $$eat the beans so easily, so $$DH $$gave $$YP $$a problem
Now $$DH $$has k operations, each operation gives four numbers $$x1 \ \ Y1 \ \ x2 \ \ Y2 $$: it means that $$DH $$will put a bean in all the squares in the rectangle with the lower left corner of $$x1, Y1 $$and the upper right corner of $$X2, Y2 $
After putting the beans, $$DH $$gives $$q $$times of inquiry, and each inquiry gives four numbers $$x1-y1-x2-y2 $$: it means to ask how many beans there are in the rectangle
This problem is very difficult for $$YP $$. If $$YP $$wants to eat beans, he must answer all the questions of $$DH $$. Try programming to help $$YP $$solve this problem
###Input format:
Enter a line of four numbers $$n, m, K, q $$
There are k operations and Q queries
$$1<=n,m<=2000; 1<=k<=200000; 1<=q<=200000$$
Next, the $$k $$line has four digits in each line $$x1-y1-x2-y2 $$:
It means that all the squares in the rectangle with the lower left corner of $$x1, Y1 $$and the upper right corner of $$X2, Y2 $$are put into a bean
The following $$q $$lines, each with four digits $$x1-y1-x2-y2 $$:
It means to ask how many beans there are in the rectangle with the lower left corner of $$x1, Y1 $$and the upper right corner of $$X2, Y2 $
$$1<=X1,X2<=n; 1<=Y1,Y2<=m$$
###Output format:
Output $$q $$lines, a number in each line, indicating the answer to the corresponding query
###Input example:
Here is a set of inputs. For example:
```in
2 2 1 1
1 1 2 2
1 1 2 1
```
###Output example:
The corresponding output is given here. For example:
```out
two
```







answer:If there is no answer, please comment