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 <iostream>
using namespace std;
int main() {
int H, W;
cin >> H >> W;
int ans = 0;
char grid[H][W];
for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) cin >> grid[i][j];
for (int i = 1; i <= H; i++) for (int j = 1; j <= W; j++) for (int k = i; k <= H; k++) for (int l = j; l <= W; l++) ans += (grid[i - 1][j - 1] == 'J' && grid[i - 1][l - 1] == 'O' && grid[k - 1][j - 1] == 'I');
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |