Submission #886274

#TimeUsernameProblemLanguageResultExecution timeMemory
886274stefanneaguBitaro the Brave (JOI19_ho_t1)C++17
0 / 100
0 ms348 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...