-
Notifications
You must be signed in to change notification settings - Fork 1
/
aoj_1068.test.cpp
36 lines (31 loc) · 881 Bytes
/
aoj_1068.test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#define PROBLEM "https://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1068"
#include "../../data_structure/segtree.hpp"
#include "../../data_structure/segtree_2d.hpp"
#include "../../template/template.hpp"
using namespace lib;
int op(int a, int b) {
return a < b ? a : b;
}
int e() {
return std::numeric_limits<int>::max();
}
int main() {
int r, c, q;
while (std::cin >> r >> c >> q, !(r == 0 && c == 0 && q == 0)) {
segtree_2d<int, op, e, segtree<int, op, e>> seg2d(r, c);
rep(i, 0, r) {
rep(j, 0, c) {
int grid;
std::cin >> grid;
seg2d.set(i, j, grid);
}
}
while (q--) {
int l, d, r, u;
std::cin >> l >> d >> r >> u;
r++;
u++;
std::cout << seg2d.prod(l, d, r, u) << '\n';
}
}
}