#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{
last=-1;
}
}
sum = min(sum,ans);
}
for(int j=0; j<m; ++j){
for(int i=0; i<n; ++i){
if(v[i][j]=='#' && last==-1){
++ans;
last=1;
}
else{
last=-1;
}
}
sum = min(sum,ans);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |