Submission #475247

# Submission time Handle Problem Language Result Execution time Memory
475247 2021-09-21T15:42:53 Z Beboo44 Selotejp (COCI20_selotejp) C++14
0 / 110
1 ms 204 KB
#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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -