#include <iostream>
using namespace std;
int h, w;
long long cntfin;
char s[3001][3001];
int main()
{
cin>>h>>w;
for(int i=1; i<=h; i++)
{
for(int j=1; j<=w; j++)
cin>>s[i][j];
}
for(int i=1; i<=h; i++)
{
for(int j=1; j<=w; j++)
{
if(s[i][j]=='J')
{
int ocnt=0, icnt=0;
for(int l=j+1; l<=w; l++)
{
if(s[i][l]=='O')
ocnt++;
}
for(int k=i+1; k<=h; k++)
{
if(s[k][j]=='I')
icnt++;
}
cntfin+=ocnt*icnt;
}
}
}
cout<<cntfin;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
2 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
2 ms |
604 KB |
Output is correct |
14 |
Correct |
26 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1628 KB |
Output is correct |
16 |
Correct |
17 ms |
1112 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
37 ms |
1884 KB |
Output is correct |
19 |
Correct |
16 ms |
1884 KB |
Output is correct |
20 |
Correct |
47 ms |
1624 KB |
Output is correct |
21 |
Correct |
38 ms |
2140 KB |
Output is correct |
22 |
Correct |
45 ms |
2140 KB |
Output is correct |
23 |
Correct |
44 ms |
2136 KB |
Output is correct |
24 |
Correct |
58 ms |
2140 KB |
Output is correct |
25 |
Correct |
16 ms |
2140 KB |
Output is correct |
26 |
Correct |
44 ms |
2120 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
604 KB |
Output is correct |
8 |
Correct |
1 ms |
604 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
2 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
2 ms |
604 KB |
Output is correct |
14 |
Correct |
26 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1628 KB |
Output is correct |
16 |
Correct |
17 ms |
1112 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
37 ms |
1884 KB |
Output is correct |
19 |
Correct |
16 ms |
1884 KB |
Output is correct |
20 |
Correct |
47 ms |
1624 KB |
Output is correct |
21 |
Correct |
38 ms |
2140 KB |
Output is correct |
22 |
Correct |
45 ms |
2140 KB |
Output is correct |
23 |
Correct |
44 ms |
2136 KB |
Output is correct |
24 |
Correct |
58 ms |
2140 KB |
Output is correct |
25 |
Correct |
16 ms |
2140 KB |
Output is correct |
26 |
Correct |
44 ms |
2120 KB |
Output is correct |
27 |
Execution timed out |
1061 ms |
17492 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |