#include <bits/stdc++.h>
#define int long long
using namespace std;
char a[15][15];
int ans[10];
int n,m;
bool check ( int i, int j, int i2, int j2, int i3, int j3, int i4, int j4 ) {
int mini = min ({i,i2,i3,i4,j,j2,j3,j4});
int maxi1 = max ({i,i2,i3,i4}) , maxi2 = max ({j,j2,j3,j4});
if(mini<0 || maxi1>=n || maxi2>=m) return false;
set<int> st;
st.insert(a[i][j]), st.insert(a[i2][j2]), st.insert(a[i3][j3]), st.insert(a[i4][j4]);
if(st.size()>1 || (*st.begin())=='.') return false;
return true;
}
signed main() {
cin>>n>>m;
for(int i=0; i<n; i++)
for(int j=0; j<m; j++)
cin>>a[i][j];
int t=0,t4=0,t2=0,t3=0;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++) {
if(check(i,j, i-1,j, i,j+1, i-1, j+1)) ans[0]++;
if(check(i,j,i,j+1, i,j+2, i,j+3)) ans[1]++;
if(check(i,j,i+1,j, i+2,j, i+3,j)) ans[1]++;
if(check(i,j,i,j+1, i-1,j+1, i-1, j+2)) ans[2]++, t++;
if(check(i,j,i+1,j, i+1,j+1, i+2, j+1)) ans[2]++, t2++;
if(check(i,j, i,j-1, i-1,j-1, i-1, j-2)) ans[3]++;
if(check(i,j, i-1,j, i-1,j+1, i-2, j+1)) ans[3]++;
if(check(i,j,i,j+1, i, j+2, i-1,j+1)) ans[4]++;
if(check(i,j,i+1,j, i+2, j, i+1,j+1)) ans[4]++;
if(check(i,j,i,j-1, i,j-2, i+1,j-1)) ans[4]++;
if(check(i,j,i-1,j, i-2, j, i-1,j-1)) ans[4]++;
}
}
for(int i=0; i<5; i++) cout<<ans[i]<<'\n';
return 0;
}
Compilation message
tetris.cpp: In function 'int main()':
tetris.cpp:25:12: warning: unused variable 't4' [-Wunused-variable]
25 | int t=0,t4=0,t2=0,t3=0;
| ^~
tetris.cpp:25:22: warning: unused variable 't3' [-Wunused-variable]
25 | int t=0,t4=0,t2=0,t3=0;
| ^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
440 KB |
Output is correct |