This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int nmax = 1e3 + 1;
char mat[nmax][nmax];
int O[nmax], I[nmax];
int32_t main() {
int n, m;
cin >> n >> m;
for(int i = 1; i <= n; i ++) {
for(int j = 1; j <= m; j ++) {
cin >> mat[i][j];
if(mat[i][j] == 'O') {
O[i] ++;
}
if(mat[i][j] == 'I') {
I[j] ++;
}
}
}
long long ans = 0;
for(int i = 1; i <= n; i ++) {
for(int j = 1; j <= n; j ++) {
if(mat[i][j] == 'J') {
ans += (long long) I[j] * O[i];
}
}
}
cout << ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |