Submission

Status:
PPPPPPPPPP

Score: 100

User: ShynyC

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-04-17 21:35:41

#include <iostream>
#include <set>
using namespace std;

int main(){
    int w,l,temp,count = 0;
    cin >> w >> l;
    int arr[w][l];
    set<int> types;
    for(int i = 0; i < w; i++){
        for(int j = 0; j < l; j++){
            cin >> temp;
            arr[i][j] = temp;
        }
    }
    if(w >= 5 && l >= 5){
        for(int i = 0; i <= w-5; i++){
            for(int j = 0; j <= l-5; j++){
                for(int k = 0; k < 5; k++){
                    for(int l = 0; l < 5; l++){
                        types.insert(arr[i+k][j+l]);
                    }
                }
                if(types.size() >= 5){
                    count++;
                }
                types.clear();
            }
        }
    }else{
        count = 0;
    }
    cout << count;
}