#include <bits/stdc++.h>
#define st first
#define nd second
#define db double
#define re register
#define pb push_back
#define mk make_pair
#define int long long
#define ldb long double
#define pii pair<int, int>
#define ull unsigned long long
#define mst(a, b) memset(a, b, sizeof(a))
using namespace std;
const int N = 3e2 + 10;
inline int read()
{
int s = 0, w = 1;
char ch = getchar();
while(ch < '0' || ch > '9') { if(ch == '-') w *= -1; ch = getchar(); }
while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
return s * w;
}
int n, m, V, x, y, A;
int mx[N], cnt[N], a[N][N];
signed main()
{
n = read(), m = read(), V = read(), x = read(), y = read();
for(re int i = 1; i <= n; i++)
for(re int j = 1; j <= m; j++) a[i][j] = read();
for(re int i = 1; i <= n; i++){
for(re int j = 1; j <= m; j++){
if(!mx[a[i][j]]) A += 1;
mx[a[i][j]] += 1;
}
}
for(re int t = 1; t <= n - x + 1; t++){
for(re int c = 1; c <= V; c++) cnt[c] = 0;
// cout << cnt[]
int ans = 0;
for(re int i = t; i <= t + x - 1; i++){
for(re int j = 1; j <= y; j++){
// if(a[i][j] == 5) cout << "Yes\n";
cnt[a[i][j]] += 1;
if(cnt[a[i][j]] == mx[a[i][j]]) ans += 1;
}
}
printf("%lld ", A - ans);
//cout << "Begin: " << t << "\n";
for(re int j = y + 1; j <= m; j++){
//cout << j << " " << j - y << "\n";
for(re int i = t; i <= t + x - 1; i++){
if(cnt[a[i][j - y]] == mx[a[i][j - y]]) ans -= 1;
cnt[a[i][j - y]] -= 1;
cnt[a[i][j]] += 1;
if(cnt[a[i][j]] == mx[a[i][j]]) ans += 1;
}
// cout << cnt[5] << " " << cnt[4] << " " << ans << "\n";
printf("%lld ", A - ans);
}
puts("");
}
return 0;
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:28:14: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
28 | for(re int i = 1; i <= n; i++)
| ^
./Main.cpp:29:16: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
29 | for(re int j = 1; j <= m; j++) a[i][j] = read();
| ^
./Main.cpp:30:14: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
30 | for(re int i = 1; i <= n; i++){
| ^
./Main.cpp:31:16: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
31 | for(re int j = 1; j <= m; j++){
| ^
./Main.cpp:36:14: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
36 | for(re int t = 1; t <= n - x + 1; t++){
| ^
./Main.cpp:37:16: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
37 | for(re int c = 1; c <= V; c++) cnt[c] = 0;
| ^
./Main.cpp:40:16: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
40 | for(re int i = t; i <= t + x - 1; i++){
| ^
./Main.cpp:41:18: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
41 | for(re int j = 1; j <= y; j++){
| ^
./Main.cpp:49:16: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
49 | for(re int j = y + 1; j <= m; j++){
| ^
./Main.cpp:51:18: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]
51 | for(re int i = t; i <= t + x - 1; i++){
| ^