# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1258758 | khanhan | Bitaro the Brave (JOI19_ho_t1) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int h, w;
cin >> h >> w;
vector<string> a(h);
for (int i = 0; i < h; i++) {
cin >> a[i];
}
long long ans = 0;
for (int i = 0; i < h; i++) {
for (int k = i + 1; k < h; k++) {
vector<int> demO(w + 1, 0);
for (int j = w - 1; j >= 0; j--) {
dem[j] = demO[j + 1] + (a[i][j] == 'O');
}
for (int j = 0; j < w; j++) {
if (a[i][j] == 'J' && a[k][j] == 'I') {
ans += demO[j + 1];
}
}
}
}
cout << ans << "\n";
return 0;
}