Submission

Status:
PPPPPPPPPP

Score: 100

User: akuyga1

Problemset: ความหลากหลาย

Language: cpp

Time: 0.003 second

Submitted On: 2025-02-25 13:30:14

#include "bits/stdc++.h"
using namespace std;
int main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    int N,M;
    cin>>N>>M;
    int A[N][M];
    for(auto& i:A)
        for(auto& j:i)cin>>j;
    int c=0;
    for(int i=0;i+4<N;i++)
        for(int j=0;j+4<M;j++){
            vector<bool> type(10,false);
            int temp=0;
            for(int x=i;x<=i+4;x++)
                for(int y=j;y<=j+4;y++){
                    if(!type[A[x][y]]){
                        type[A[x][y]]=true;
                        temp++;
                    }
                }
            if(temp>=5)c++;
        }

    cout<<c;
}