#include <bits/stdc++.h>
using namespace std;
int O[3005][3005], I[3005][3005];
char a[3005][3005];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
for (int i=1; i<=n; i++)
for (int j=1; j<=m; j++)
cin >> a[i][j];
long long ans=0;
for (int i=n; i>=1; i--)
{
for (int j=m; j>=1; j--)
{
O[i][j]=O[i][j+1]+(a[i][j]=='O');
I[i][j]=I[i+1][j]+(a[i][j]=='I');
ans+=O[i][j]*I[i][j]*(a[i][j]=='J');
}
}
cout << ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
324 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
1484 KB |
Output is correct |
6 |
Correct |
1 ms |
1492 KB |
Output is correct |
7 |
Correct |
1 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
1484 KB |
Output is correct |
9 |
Correct |
1 ms |
1484 KB |
Output is correct |
10 |
Correct |
1 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1484 KB |
Output is correct |
12 |
Correct |
1 ms |
1484 KB |
Output is correct |
13 |
Correct |
1 ms |
1356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
324 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
1484 KB |
Output is correct |
6 |
Correct |
1 ms |
1492 KB |
Output is correct |
7 |
Correct |
1 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
1484 KB |
Output is correct |
9 |
Correct |
1 ms |
1484 KB |
Output is correct |
10 |
Correct |
1 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1484 KB |
Output is correct |
12 |
Correct |
1 ms |
1484 KB |
Output is correct |
13 |
Correct |
1 ms |
1356 KB |
Output is correct |
14 |
Correct |
6 ms |
7500 KB |
Output is correct |
15 |
Correct |
2 ms |
4940 KB |
Output is correct |
16 |
Correct |
4 ms |
4300 KB |
Output is correct |
17 |
Correct |
1 ms |
460 KB |
Output is correct |
18 |
Correct |
10 ms |
8008 KB |
Output is correct |
19 |
Correct |
8 ms |
7876 KB |
Output is correct |
20 |
Correct |
10 ms |
7888 KB |
Output is correct |
21 |
Correct |
7 ms |
8012 KB |
Output is correct |
22 |
Correct |
7 ms |
7892 KB |
Output is correct |
23 |
Correct |
7 ms |
7760 KB |
Output is correct |
24 |
Correct |
7 ms |
8012 KB |
Output is correct |
25 |
Correct |
7 ms |
7884 KB |
Output is correct |
26 |
Correct |
7 ms |
7756 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
324 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
0 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
1 ms |
1484 KB |
Output is correct |
6 |
Correct |
1 ms |
1492 KB |
Output is correct |
7 |
Correct |
1 ms |
1356 KB |
Output is correct |
8 |
Correct |
1 ms |
1484 KB |
Output is correct |
9 |
Correct |
1 ms |
1484 KB |
Output is correct |
10 |
Correct |
1 ms |
1356 KB |
Output is correct |
11 |
Correct |
1 ms |
1484 KB |
Output is correct |
12 |
Correct |
1 ms |
1484 KB |
Output is correct |
13 |
Correct |
1 ms |
1356 KB |
Output is correct |
14 |
Correct |
6 ms |
7500 KB |
Output is correct |
15 |
Correct |
2 ms |
4940 KB |
Output is correct |
16 |
Correct |
4 ms |
4300 KB |
Output is correct |
17 |
Correct |
1 ms |
460 KB |
Output is correct |
18 |
Correct |
10 ms |
8008 KB |
Output is correct |
19 |
Correct |
8 ms |
7876 KB |
Output is correct |
20 |
Correct |
10 ms |
7888 KB |
Output is correct |
21 |
Correct |
7 ms |
8012 KB |
Output is correct |
22 |
Correct |
7 ms |
7892 KB |
Output is correct |
23 |
Correct |
7 ms |
7760 KB |
Output is correct |
24 |
Correct |
7 ms |
8012 KB |
Output is correct |
25 |
Correct |
7 ms |
7884 KB |
Output is correct |
26 |
Correct |
7 ms |
7756 KB |
Output is correct |
27 |
Correct |
150 ms |
87884 KB |
Output is correct |
28 |
Correct |
14 ms |
26028 KB |
Output is correct |
29 |
Correct |
12 ms |
7756 KB |
Output is correct |
30 |
Correct |
1 ms |
588 KB |
Output is correct |
31 |
Correct |
113 ms |
72488 KB |
Output is correct |
32 |
Correct |
160 ms |
88360 KB |
Output is correct |
33 |
Correct |
152 ms |
88132 KB |
Output is correct |
34 |
Correct |
128 ms |
84032 KB |
Output is correct |
35 |
Correct |
155 ms |
88360 KB |
Output is correct |
36 |
Correct |
155 ms |
88108 KB |
Output is correct |
37 |
Correct |
158 ms |
88584 KB |
Output is correct |
38 |
Correct |
108 ms |
72416 KB |
Output is correct |
39 |
Correct |
108 ms |
72240 KB |
Output is correct |