Submission #1207435

#TimeUsernameProblemLanguageResultExecution timeMemory
1207435rhm_ganBitaro the Brave (JOI19_ho_t1)C++20
0 / 100
1 ms324 KiB
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 42
#endif

#define int long long

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, m;
    cin >> n >> m;

    vector<string> a(n);
    vector<int> r(n), c(m);

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

    int ans = 0;
    for (int i = 0; i < n; i++) {
    	for (int j = 0; j < n; j++) {
	    	if (a[i][j] == 'J') {
	    		ans += r[i] * c[j];
	    	}
    	}
    }

    cout << ans << '\n';

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