Submission
Status:
PPPPPPPPPP
Score: 100
User: mydKN
Problemset: ความหลากหลาย
Language: cpp
Time: 0.002 second
Submitted On: 2024-12-03 23:57:48
#include<bits/stdc++.h>
using namespace std;
const int maxn = 55;
int n, m;
int arr[maxn][maxn];
int res;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
cin >> n >> m;
for(int i=0;i<n;++i){
for(int j=0;j<m;++j){
cin >> arr[i][j];
}
}
for(int i=0;i<=n-5;++i){
for(int j=0;j<=m-5;++j){
bool found[10] = {};
int cnt = 0;
for(int k=0;k<5;++k){
for(int l=0;l<5;++l){
if(!found[arr[i+k][j+l]]){
found[arr[i+k][j+l]] = 1;
++cnt;
}
}
}
if(cnt >= 5) ++res;
}
}
cout << res;
}