#include <bits/stdc++.h>
#define MAX 3010
#define ll long long
using namespace std;
int n, m;
ll ans;
ll PO[MAX][MAX];
ll PI[MAX][MAX];
char v[MAX][MAX];
int main()
{
cin >> n >> m ;
for(int g = 1 ; g <= n ; g++)
for(int h = 1 ; h <= m ; h++)
cin >> v[g][h];
for(int g = 1 ; g <= n ; g++)
for(int h = m ; h > 0 ; h--)
PO[g][h] = PO[g][h + 1] + (v[g][h] == 'O') ;
for(int g = n ; g > 0 ; g--)
for(int h = 1 ; h <= m ; h++)
PI[g][h] = PI[g + 1][h] + (v[g][h] == 'I') ;
for(int g = 1 ; g <= n ; g++)
for(int h = 1 ; h <= m ; h++)
if(v[g][h] == 'J')
ans += PO[g][h] * PI[g][h];
cout << ans ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
1528 KB |
Output is correct |
6 |
Correct |
4 ms |
1528 KB |
Output is correct |
7 |
Correct |
4 ms |
1532 KB |
Output is correct |
8 |
Correct |
4 ms |
1528 KB |
Output is correct |
9 |
Correct |
4 ms |
1532 KB |
Output is correct |
10 |
Correct |
4 ms |
1528 KB |
Output is correct |
11 |
Correct |
4 ms |
1528 KB |
Output is correct |
12 |
Correct |
4 ms |
1528 KB |
Output is correct |
13 |
Correct |
4 ms |
1400 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
1528 KB |
Output is correct |
6 |
Correct |
4 ms |
1528 KB |
Output is correct |
7 |
Correct |
4 ms |
1532 KB |
Output is correct |
8 |
Correct |
4 ms |
1528 KB |
Output is correct |
9 |
Correct |
4 ms |
1532 KB |
Output is correct |
10 |
Correct |
4 ms |
1528 KB |
Output is correct |
11 |
Correct |
4 ms |
1528 KB |
Output is correct |
12 |
Correct |
4 ms |
1528 KB |
Output is correct |
13 |
Correct |
4 ms |
1400 KB |
Output is correct |
14 |
Correct |
29 ms |
8824 KB |
Output is correct |
15 |
Correct |
6 ms |
5112 KB |
Output is correct |
16 |
Correct |
19 ms |
5240 KB |
Output is correct |
17 |
Correct |
2 ms |
504 KB |
Output is correct |
18 |
Correct |
36 ms |
9724 KB |
Output is correct |
19 |
Correct |
34 ms |
9592 KB |
Output is correct |
20 |
Correct |
34 ms |
9596 KB |
Output is correct |
21 |
Correct |
36 ms |
9720 KB |
Output is correct |
22 |
Correct |
38 ms |
9612 KB |
Output is correct |
23 |
Correct |
35 ms |
9580 KB |
Output is correct |
24 |
Correct |
39 ms |
9720 KB |
Output is correct |
25 |
Correct |
34 ms |
9592 KB |
Output is correct |
26 |
Correct |
35 ms |
9496 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
4 ms |
1528 KB |
Output is correct |
6 |
Correct |
4 ms |
1528 KB |
Output is correct |
7 |
Correct |
4 ms |
1532 KB |
Output is correct |
8 |
Correct |
4 ms |
1528 KB |
Output is correct |
9 |
Correct |
4 ms |
1532 KB |
Output is correct |
10 |
Correct |
4 ms |
1528 KB |
Output is correct |
11 |
Correct |
4 ms |
1528 KB |
Output is correct |
12 |
Correct |
4 ms |
1528 KB |
Output is correct |
13 |
Correct |
4 ms |
1400 KB |
Output is correct |
14 |
Correct |
29 ms |
8824 KB |
Output is correct |
15 |
Correct |
6 ms |
5112 KB |
Output is correct |
16 |
Correct |
19 ms |
5240 KB |
Output is correct |
17 |
Correct |
2 ms |
504 KB |
Output is correct |
18 |
Correct |
36 ms |
9724 KB |
Output is correct |
19 |
Correct |
34 ms |
9592 KB |
Output is correct |
20 |
Correct |
34 ms |
9596 KB |
Output is correct |
21 |
Correct |
36 ms |
9720 KB |
Output is correct |
22 |
Correct |
38 ms |
9612 KB |
Output is correct |
23 |
Correct |
35 ms |
9580 KB |
Output is correct |
24 |
Correct |
39 ms |
9720 KB |
Output is correct |
25 |
Correct |
34 ms |
9592 KB |
Output is correct |
26 |
Correct |
35 ms |
9496 KB |
Output is correct |
27 |
Correct |
1000 ms |
150528 KB |
Output is correct |
28 |
Correct |
28 ms |
26360 KB |
Output is correct |
29 |
Correct |
77 ms |
13944 KB |
Output is correct |
30 |
Correct |
5 ms |
760 KB |
Output is correct |
31 |
Correct |
751 ms |
131712 KB |
Output is correct |
32 |
Execution timed out |
1018 ms |
159392 KB |
Time limit exceeded |
33 |
Halted |
0 ms |
0 KB |
- |