#include <bits/stdc++.h>
using namespace std;
bool check(int x, int y, int n, int m){
return (0 <= x && x < n && 0 <= y && y < m);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<vector<char>>g(n, vector<char>(m));
for(int i = 0;i < n;++i){
for(int j = 0;j < m;++j){
cin >> g[i][j];
}
}
int say[5] = {};
for(int i = 0;i < n;++i){
for(int j = 0;j < m;++j){
bool ch = check(i + 1, j + 1, n, m);
if(!ch)continue;
bool equiv = g[i][j] == g[i + 1][j] && \
g[i + 1][j] == g[i][j + 1] && \
g[i][j + 1] == g[i + 1][j + 1];
if(ch && equiv && g[i][j] != '.'){
say[0]++;
}
}
}
for(int i = 0;i < 5;++i){
cout << say[i] << '\n';
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |