Submission

Status:
PPP-xxPPPP

Score: 70

User: akuyga1

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-02-25 13:26:04

#include "bits/stdc++.h"
using namespace std;
int main(){
    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<N;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;
}