#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn = 3e3 + 10;
char mat[maxn][maxn];
ll li[maxn], col[maxn];
int main(){
int n, m; cin >> n >> m;
for( int i = 1; i <= n; i++ ) for( int j = 1; j <= m; j++ ) cin >> mat[i][j];
ll resp = 0;
for( int i = n; i > 0; i-- ){
for( int j = m; j > 0; j-- ){
char c = mat[i][j];
if( c == 'J' ) resp += li[i]*col[j];
if( c == 'O' ) li[i]++;
if( c == 'I' ) col[j]++;
}
}
cout << resp;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
568 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
576 KB |
Output is correct |
12 |
Correct |
1 ms |
596 KB |
Output is correct |
13 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
568 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
576 KB |
Output is correct |
12 |
Correct |
1 ms |
596 KB |
Output is correct |
13 |
Correct |
1 ms |
596 KB |
Output is correct |
14 |
Correct |
15 ms |
1980 KB |
Output is correct |
15 |
Correct |
2 ms |
1492 KB |
Output is correct |
16 |
Correct |
8 ms |
1108 KB |
Output is correct |
17 |
Correct |
1 ms |
308 KB |
Output is correct |
18 |
Correct |
21 ms |
2004 KB |
Output is correct |
19 |
Correct |
17 ms |
1968 KB |
Output is correct |
20 |
Correct |
16 ms |
1904 KB |
Output is correct |
21 |
Correct |
16 ms |
1992 KB |
Output is correct |
22 |
Correct |
15 ms |
1908 KB |
Output is correct |
23 |
Correct |
15 ms |
1920 KB |
Output is correct |
24 |
Correct |
19 ms |
1924 KB |
Output is correct |
25 |
Correct |
17 ms |
2016 KB |
Output is correct |
26 |
Correct |
15 ms |
1896 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
312 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
568 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
596 KB |
Output is correct |
10 |
Correct |
2 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
576 KB |
Output is correct |
12 |
Correct |
1 ms |
596 KB |
Output is correct |
13 |
Correct |
1 ms |
596 KB |
Output is correct |
14 |
Correct |
15 ms |
1980 KB |
Output is correct |
15 |
Correct |
2 ms |
1492 KB |
Output is correct |
16 |
Correct |
8 ms |
1108 KB |
Output is correct |
17 |
Correct |
1 ms |
308 KB |
Output is correct |
18 |
Correct |
21 ms |
2004 KB |
Output is correct |
19 |
Correct |
17 ms |
1968 KB |
Output is correct |
20 |
Correct |
16 ms |
1904 KB |
Output is correct |
21 |
Correct |
16 ms |
1992 KB |
Output is correct |
22 |
Correct |
15 ms |
1908 KB |
Output is correct |
23 |
Correct |
15 ms |
1920 KB |
Output is correct |
24 |
Correct |
19 ms |
1924 KB |
Output is correct |
25 |
Correct |
17 ms |
2016 KB |
Output is correct |
26 |
Correct |
15 ms |
1896 KB |
Output is correct |
27 |
Correct |
513 ms |
17620 KB |
Output is correct |
28 |
Correct |
5 ms |
7124 KB |
Output is correct |
29 |
Correct |
44 ms |
1624 KB |
Output is correct |
30 |
Correct |
2 ms |
340 KB |
Output is correct |
31 |
Correct |
422 ms |
13888 KB |
Output is correct |
32 |
Correct |
510 ms |
17968 KB |
Output is correct |
33 |
Correct |
512 ms |
18024 KB |
Output is correct |
34 |
Correct |
450 ms |
15912 KB |
Output is correct |
35 |
Correct |
521 ms |
17904 KB |
Output is correct |
36 |
Correct |
585 ms |
17844 KB |
Output is correct |
37 |
Correct |
601 ms |
18064 KB |
Output is correct |
38 |
Correct |
390 ms |
13768 KB |
Output is correct |
39 |
Correct |
371 ms |
13756 KB |
Output is correct |