Massimo per matrice
Problem
Data una matrice a di dimensione \(n \cdot n\) (\(1 <= n < ;= 1000\), \(1 <= a_i <= 10^9\)). Vengono fornite anche le query m (\(1 <= m <= 1000\)) nella forma x1< /sub>, y1, x2, y< sub>2 (\(1 <= x_1 <= n\), \(1 <= y_1 <= n\), \(x_1 <= x_2 <= n\), \(y_1 <= y_2 <= n\)).
Per ogni query, genera l'elemento massimo nella sottomatrice con le coordinate del bordo
x1,
y1 e x2,
y2.
Esempi
| # |
Input |
Uscita |
| 1 |
4
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
1
1 1 3 4
|
6 |