Submission #1192098

#TimeUsernameProblemLanguageResultExecution timeMemory
1192098badge881Bitaro the Brave (JOI19_ho_t1)C++20
50 / 100
1093 ms11848 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;

int h, w;
const int maxw = 3001;
int cntj[maxw];
string s[maxw];

signed main() {
  cin >> h >> w;
  for (int i = 0; i < h; i++)
    cin >> s[i];
    

  long long ans = 0;
  for (int i = 0; i < w; i++)
    cntj[i] = 0;
    

  for (int i = 0; i < h; i++){
    for (int j = 0; j < w; j++) 
      if (s[i][j] == 'O') 
        for (int k = 0; k < j; k++) 
          if (s[i][k] == 'J') 
            cntj[k]++;
    for (int j = 0; j < w; j++) 
      if (s[i][j] == 'I') 
        ans += cntj[j];
  }
  cout << ans << endl;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...