Submission #295775

#TimeUsernameProblemLanguageResultExecution timeMemory
295775MilosMilutinovicEmacs (COCI20_emacs)C++14
50 / 50
1 ms512 KiB
#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    vector<string> s(n);
    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }
    vector<vector<bool>> take(n, vector<bool>(m, false));
    int ans = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (s[i][j] == '.') {
                continue;
            }
            if (!take[i][j]) {
                ans++;
                take[i][j] = true;
            }
            if (i < n - 1) take[i + 1][j] = true;
            if (j < m - 1) take[i][j + 1] = true;
        }
    }
    cout << ans << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...