#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m;
bool valid(ll i,ll j){
if(i>=0 && j>=0 && i<n && j<m)return 1;
return 0;
}
int main()
{
cin>>n>>m;
vector<string>arr(n);
for(auto &i:arr)cin>>i;
ll a=0,b=0,c=0,d=0,e=0;
map<pair<ll,ll>,bool>vis;
for(ll i=0;i<n;i++){
for(ll j=0;j<m;j++){
if(vis[{i,j}])continue;
else if(valid(i,j+1) && valid(i+1,j) && valid(i+1,j+1)){
if(arr[i][j]==arr[i][j+1] && arr[i][j+1]==arr[i+1][j] && arr[i+1][j]==arr[i+1][j+1] && arr[i][j]!='.'){
vis[{i,j}]=1;
vis[{i,j+1}]=1;
vis[{i+1,j}]=1;
vis[{i+1,j+1}]=1;
a++;
}
}
}
}
cout<<a<<endl<<b<<endl<<c<<endl<<d<<endl<<e<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
10 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |