#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0)
int main()
{
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
ll n,m;
cin>>n>>m;
vector<vector<char>> v(n,vector<char>(m));
for(int i=0; i<n; ++i){
for(int j=0;j<m; ++j){
cin>>v[i][j];
}
}
ll sum=1e18;
ll last =-1;
ll ans=0;
for(int i=0; i<n; ++i){
for(int j=0; j<m; ++j){
if(v[i][j]=='#' && last==-1){
++ans;
last=1;
}
else if(v[i][j]=='.'){
last=-1;
}
}
last=-1;
}
sum = ans;
ans=0;
for(int j=0; j<m; ++j){
for(int i=0; i<n; ++i){
if(v[i][j]=='#' && last==-1){
++ans;
last=1;
}
else if(v[i][j]=='.'){
last=-1;
}
}
last=-1;
}
sum = min(sum,ans);
cout<<sum;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |