AT_abc278_e [ABC278E] Grid Filling

题目描述

有一个纵向 $H$ 行、横向 $W$ 列的网格。自上而下第 $i$ 行,自左而右第 $j$ 列的格子记作 $(i,j)$。在每个 $(i,j)\ (1\leq i\leq H,1\leq j\leq W)$ 上写有一个 $1$ 到 $N$ 之间的整数 $A_{i,j}$。 给定整数 $h,w$。对于所有满足 $0\leq k\leq H-h,0\leq l\leq W-w$ 的 $(k,l)$ 组合,请解决以下问题: - 当你将所有满足 $k

输入格式

输入以以下格式从标准输入给出。 > $H$ $W$ $N$ $h$ $w$ > $A_{1,1}$ $A_{1,2}$ $\dots$ $A_{1,W}$ > $A_{2,1}$ $A_{2,2}$ $\dots$ $A_{2,W}$ > $\vdots$ > $A_{H,1}$ $A_{H,2}$ $\dots$ $A_{H,W}$

输出格式

对于每个 $(k,l)$,输出答案 $\operatorname{ans}_{k,l}$,格式如下: > $\operatorname{ans}_{0,0}$ $\operatorname{ans}_{0,1}$ $\dots$ $\operatorname{ans}_{0,W-w}$ > $\operatorname{ans}_{1,0}$ $\operatorname{ans}_{1,1}$ $\dots$ $\operatorname{ans}_{1,W-w}$ > $\vdots$ > $\operatorname{ans}_{H-h,0}$ $\operatorname{ans}_{H-h,1}$ $\dots$ $\operatorname{ans}_{H-h,W-w}$

说明/提示

### 限制条件 - $1\leq H,W,N\leq 300$ - $1\leq h\leq H$ - $1\leq w\leq W$ - $(h,w)\neq(H,W)$ - $1\leq A_{i,j}\leq N\ (1\leq i\leq H,1\leq j\leq W)$ - 所有输入的值均为整数 ### 样例说明 1 给定的棋盘如下图所示。 ![](https://img.atcoder.jp/abc278/d3542563ea2e11fda78c3307c0a2b0fe.png) 例如,当 $(k,l)=(0,0)$ 时,未被涂黑的格子上写着的数有 $1,3,4,5$ 共 $4$ 种,因此答案为 $4$。 由 ChatGPT 4.1 翻译