#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
ll n,m,a,b,c,d,e,x[11][11];
int main()
{
cin>>n>>m;
char s[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>s[i][j];
x[i][j]=s[i][j];
x[i][j]-=96;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(s[i][j]==s[i][j+1]){
if(s[i][j]==s[i+1][j]&&s[i][j]==s[i+1][j+1]&&s[i][j]!='.'&&j+1<m&&i+1<n){
a++;
}
else if(s[i][j]==s[i][j+2]&&s[i][j]==s[i][j+3]&&s[i][j]!='.'&&j+3<m&&i<n){
b++;
}
else if(s[i][j]==s[i+1][j]&&s[i][j]==s[i+1][j-1]&&s[i][j]!='.'&&j-1>=0&&i+1<n){
c++;
}
else if(s[i][j]==s[i+1][j+1]&&s[i][j]==s[i-1][j]&&s[i][j]!='.'&&j+1<m&&i+1<n&&i-1>=0){
c++;
}
else if(s[i][j]==s[i+1][j+1]&&s[i][j]==s[i+1][j+2]&&s[i][j]!='.'&&j+2<m&&i+1<n){
d++;
}
else if(s[i][j]==s[i+1][j]&&s[i][j]==s[i-1][j+1]&&s[i][j]!='.'&&j+1<m&&i+1<n&&i-1>=0){
d++;
}
else if(s[i][j]==s[i-1][j+1]&&s[i][j]==s[i][j+2]&&s[i][j]!='.'&&j+2<m&&i-1>=0){
e++;
}
else if(s[i][j]==s[i+1][j+1]&&s[i][j]==s[i][j+2]&&s[i][j]!='.'&&j+2<m&&i+1<n){
e++;
}
else if(s[i][j]==s[i-1][j]&&s[i][j]==s[i+1][j]&&s[i][j]!='.'&&j<m&&i+1<n&&i-1>=0){
e++;
}
else if(s[i][j]==s[i-1][j+1]&&s[i][j]==s[i+1][j+1]&&s[i][j]!='.'&&j+1<m&&i+1<n&&i-1>=0){
e++;
}
}
else if(s[i][j]==s[i+1][j]&&s[i][j]==s[i+2][j]&&s[i][j]==s[i+3][j]&&s[i][j]!='.'&&i+3<n){
b++;
}
}
}
cout<<a<<endl<<b<<endl<<c<<endl<<d<<endl<<e;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
7 |
Correct |
1 ms |
224 KB |
Output is correct |
8 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |