제출 #1322021

#제출 시각아이디문제언어결과실행 시간메모리
1322021_nothing_Bitaro the Brave (JOI19_ho_t1)C++20
100 / 100
62 ms9376 KiB
#include <bits/stdc++.h>
using namespace std;

int numRow, numCol;

char a[3030][3030];
int sumI[3030];

int main() {
  ios_base::sync_with_stdio(false);cin.tie(nullptr);
  cin >> numRow >> numCol;
  for (int i = 1; i <= numRow; ++i) {
    string s; cin >> s;
    for (int j = 1; j <= numCol; ++j) {
      a[i][j] = s[j - 1];
    }
  }

  long long ans = 0;
  for (int i = numRow; i >= 1; --i) {
    long long pre = 0;
    for (int j = 1; j <= numCol; ++j) {
      if (a[i][j] == 'I') sumI[j] += 1;
      else if (a[i][j] == 'J') pre += sumI[j];
      else ans += pre;
    }
  }

  cout << ans;

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