You are given a
Formally, given
Implementation Details
You should implement the following functions:
void init(std::vector<std::vector<int>> arr);
: a -dimensional array of size .
int query(int a, int b, int c, int d);
: the lower bound on the first dimension of the submatrix. : the upper bound on the first dimension of the submatrix. : the lower bound on the second dimension of the submatrix. : the upper bound on the second dimension of the submatrix.- This function should return the minimum integer in the submatrix formed by
.
It is guaranteed that init
will be called exactly once, and that this call will be made before any calls to query
.
Constraints
For all subtasks:
query
query
Disclaimer:
Your answer will be considered correct if the bitwise
Subtask 1 [10%]
query
will be called at most
Subtask 2 [20%]
query
will be called at most
Subtask 3 [30%]
query
will be called at most
Subtask 4 [40%]
query
will be called at most
Sample Interaction
Please note that the sample will not appear in any of the test cases.
Function Call | Return Value |
---|---|
init({{1, 2}, {3, 4}}) |
|
query(0, 1, 0, 1) |
1 |
query(1, 1, 0, 1) |
3 |
query(0, 0, 1, 1) |
2 |
Comments