Submission #1258723

#TimeUsernameProblemLanguageResultExecution timeMemory
1258723hanguyenBitaro the Brave (JOI19_ho_t1)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int maxn = 3005;
int row[maxn], col[maxn];
char a[maxn][maxn];
int n, m;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> n >> m;
    for (int i = 0; i < n; i++) {         
        for (int j = 0; j < m; j++) {
            cin >> a[i][j];
            if (a[i][j] == 'O') row[i]++;
            if (a[i][j] == 'I') col[j]++;
        }
    }

    int res = 0;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (a[i][j] == 'J') res += row[i] * col[j];
        }
    }

    cout << res;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...