"学长手会软"——zdjd
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
题目描述
给定一个 行 列的整数矩阵,有 次询问。 每次询问给出子矩阵左上角 和右下角 ,求这个子矩阵所有元素的和。
输入格式
第一行两个整数 ,代表矩阵行数、列数。 接下来 行,每行 个整数,代表矩阵。 下一行一个整数 ,代表询问次数。 接下来 行,每行四个整数 。
输出格式
对于每组询问,输出子矩阵的和,每行一个答案。
数据范围
矩阵内每个元素 询问次数 $1 \le x_1 \le x_2 \le n,\quad 1 \le y_1 \le y_2 \le m$
样例输入
3 3
1 2 3
4 5 6
7 8 9
2
1 1 2 2
2 2 3 3
样例输出
12
28
验题
- Status
- Done
- Rule
- XCPC
- Problem
- 18
- Start at
- 2026-9-16 19:00
- End at
- 2026-9-26 19:00
- Duration
- 240 hour(s)
- Host
- Partic.
- 12