#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 |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
24 ms |
452 KB |
Output is correct |
6 |
Correct |
13 ms |
348 KB |
Output is correct |
7 |
Correct |
25 ms |
344 KB |
Output is correct |
8 |
Correct |
24 ms |
348 KB |
Output is correct |
9 |
Correct |
14 ms |
444 KB |
Output is correct |
10 |
Correct |
25 ms |
348 KB |
Output is correct |
11 |
Correct |
24 ms |
344 KB |
Output is correct |
12 |
Correct |
13 ms |
348 KB |
Output is correct |
13 |
Correct |
26 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
24 ms |
452 KB |
Output is correct |
6 |
Correct |
13 ms |
348 KB |
Output is correct |
7 |
Correct |
25 ms |
344 KB |
Output is correct |
8 |
Correct |
24 ms |
348 KB |
Output is correct |
9 |
Correct |
14 ms |
444 KB |
Output is correct |
10 |
Correct |
25 ms |
348 KB |
Output is correct |
11 |
Correct |
24 ms |
344 KB |
Output is correct |
12 |
Correct |
13 ms |
348 KB |
Output is correct |
13 |
Correct |
26 ms |
348 KB |
Output is correct |
14 |
Execution timed out |
1049 ms |
604 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
24 ms |
452 KB |
Output is correct |
6 |
Correct |
13 ms |
348 KB |
Output is correct |
7 |
Correct |
25 ms |
344 KB |
Output is correct |
8 |
Correct |
24 ms |
348 KB |
Output is correct |
9 |
Correct |
14 ms |
444 KB |
Output is correct |
10 |
Correct |
25 ms |
348 KB |
Output is correct |
11 |
Correct |
24 ms |
344 KB |
Output is correct |
12 |
Correct |
13 ms |
348 KB |
Output is correct |
13 |
Correct |
26 ms |
348 KB |
Output is correct |
14 |
Execution timed out |
1049 ms |
604 KB |
Time limit exceeded |
15 |
Halted |
0 ms |
0 KB |
- |