#include <iostream>
using namespace std;
char mat[3003][3003];
int spo[3003][3003], spi[3003][3003];
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];
spo[i][j]=spo[i][j-1]+(mat[i][j]=='O');
spi[i][j]=spi[i-1][j]+(mat[i][j]=='I');
}
}
long long cnt=0;
for(int i=1; i<=n; i++)
{
for(int j=1; j<=m; j++)
{
if(mat[i][j]=='J')
{
cnt+=(spo[i][m]-spo[i][j])*(spi[n][j]-spi[i][j]);
}
}
}
cout<<cnt;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
4956 KB |
Output is correct |
6 |
Correct |
1 ms |
3164 KB |
Output is correct |
7 |
Correct |
2 ms |
4956 KB |
Output is correct |
8 |
Correct |
1 ms |
5060 KB |
Output is correct |
9 |
Correct |
1 ms |
4956 KB |
Output is correct |
10 |
Correct |
1 ms |
4956 KB |
Output is correct |
11 |
Correct |
1 ms |
4956 KB |
Output is correct |
12 |
Correct |
1 ms |
4960 KB |
Output is correct |
13 |
Correct |
1 ms |
4956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
4956 KB |
Output is correct |
6 |
Correct |
1 ms |
3164 KB |
Output is correct |
7 |
Correct |
2 ms |
4956 KB |
Output is correct |
8 |
Correct |
1 ms |
5060 KB |
Output is correct |
9 |
Correct |
1 ms |
4956 KB |
Output is correct |
10 |
Correct |
1 ms |
4956 KB |
Output is correct |
11 |
Correct |
1 ms |
4956 KB |
Output is correct |
12 |
Correct |
1 ms |
4960 KB |
Output is correct |
13 |
Correct |
1 ms |
4956 KB |
Output is correct |
14 |
Correct |
9 ms |
13660 KB |
Output is correct |
15 |
Correct |
2 ms |
10336 KB |
Output is correct |
16 |
Correct |
8 ms |
9808 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
14 ms |
15192 KB |
Output is correct |
19 |
Correct |
10 ms |
14948 KB |
Output is correct |
20 |
Correct |
9 ms |
14940 KB |
Output is correct |
21 |
Correct |
11 ms |
15040 KB |
Output is correct |
22 |
Correct |
12 ms |
14940 KB |
Output is correct |
23 |
Correct |
10 ms |
14940 KB |
Output is correct |
24 |
Correct |
10 ms |
15048 KB |
Output is correct |
25 |
Correct |
9 ms |
14940 KB |
Output is correct |
26 |
Correct |
10 ms |
14792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
4956 KB |
Output is correct |
6 |
Correct |
1 ms |
3164 KB |
Output is correct |
7 |
Correct |
2 ms |
4956 KB |
Output is correct |
8 |
Correct |
1 ms |
5060 KB |
Output is correct |
9 |
Correct |
1 ms |
4956 KB |
Output is correct |
10 |
Correct |
1 ms |
4956 KB |
Output is correct |
11 |
Correct |
1 ms |
4956 KB |
Output is correct |
12 |
Correct |
1 ms |
4960 KB |
Output is correct |
13 |
Correct |
1 ms |
4956 KB |
Output is correct |
14 |
Correct |
9 ms |
13660 KB |
Output is correct |
15 |
Correct |
2 ms |
10336 KB |
Output is correct |
16 |
Correct |
8 ms |
9808 KB |
Output is correct |
17 |
Correct |
1 ms |
2396 KB |
Output is correct |
18 |
Correct |
14 ms |
15192 KB |
Output is correct |
19 |
Correct |
10 ms |
14948 KB |
Output is correct |
20 |
Correct |
9 ms |
14940 KB |
Output is correct |
21 |
Correct |
11 ms |
15040 KB |
Output is correct |
22 |
Correct |
12 ms |
14940 KB |
Output is correct |
23 |
Correct |
10 ms |
14940 KB |
Output is correct |
24 |
Correct |
10 ms |
15048 KB |
Output is correct |
25 |
Correct |
9 ms |
14940 KB |
Output is correct |
26 |
Correct |
10 ms |
14792 KB |
Output is correct |
27 |
Correct |
305 ms |
87888 KB |
Output is correct |
28 |
Correct |
10 ms |
34652 KB |
Output is correct |
29 |
Correct |
21 ms |
11100 KB |
Output is correct |
30 |
Correct |
2 ms |
2656 KB |
Output is correct |
31 |
Correct |
259 ms |
73196 KB |
Output is correct |
32 |
Correct |
321 ms |
88404 KB |
Output is correct |
33 |
Correct |
299 ms |
88308 KB |
Output is correct |
34 |
Correct |
257 ms |
84824 KB |
Output is correct |
35 |
Correct |
290 ms |
88404 KB |
Output is correct |
36 |
Correct |
312 ms |
88176 KB |
Output is correct |
37 |
Correct |
316 ms |
88400 KB |
Output is correct |
38 |
Correct |
243 ms |
73148 KB |
Output is correct |
39 |
Correct |
198 ms |
72784 KB |
Output is correct |