#include<bits/stdc++.h>
using namespace std;
char grid[15][15];
int red,stup;
int rj[5];
void provjeri(int a,int b){
if(grid[a][b] == grid[a+1][b] && grid[a][b] == grid[a+1][b+1] && grid[a][b] == grid[a][b+1]) rj[0]++;
else if(grid[a][b] == grid[a][b+1] && grid[a][b] == grid[a][b+2] && grid[a][b] == grid[a][b+3]) rj[1]++;
else if(grid[a][b] == grid[a][b+1] && grid[a][b] == grid[a-1][b+1] && grid[a][b] == grid[a-1][b+2]) rj[2]++;
else if(grid[a][b] == grid[a][b+1] && grid[a][b] == grid[a+1][b+1] && grid[a][b] == grid[a+1][b+2]) rj[3]++;
else if(grid[a][b] == grid[a+1][b] && grid[a][b] == grid[a+1][b+1] && grid[a][b] == grid[a+1][b-1]) rj[4]++;
}
int main(){
cin >> red >> stup;
for(int i = 0; i < red; i++){
cin >> grid[i];
}
memset(rj,0,sizeof(rj));
for(int i = 0; i < red; i++){
for(int j = 0; j < stup; j++){
if(grid[i][j] == '.') continue;
provjeri(i,j);
}
}
for(int i = 0; i < 5; i++){
cout << rj[i] << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
492 KB |
Output is correct |
3 |
Incorrect |
2 ms |
492 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
608 KB |
Output isn't correct |