#include <iostream>
using namespace std;
int h, w;
long long cntfin;
int ocnts[3001];
char s[3001][3001];
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
cin>>h>>w;
for(int i=1; i<=h; i++)
{
for(int j=1; j<=w; j++)
{
cin>>s[i][j];
if(s[i][j]=='O')
ocnts[i]++;
}
}
for(int i=1; i<=h; i++)
{
for(int j=1; j<=w; j++)
{
if(s[i][j]=='O')
ocnts[i]--;
if(s[i][j]=='J')
{
int icnt=0;
for(int k=i+1; k<=h; k++)
{
if(s[k][j]=='I')
icnt++;
}
cntfin+=ocnts[i]*icnt;
}
}
}
cout<<cntfin;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
0 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
0 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
20 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1628 KB |
Output is correct |
16 |
Correct |
8 ms |
984 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
26 ms |
1884 KB |
Output is correct |
19 |
Correct |
9 ms |
1884 KB |
Output is correct |
20 |
Correct |
29 ms |
1908 KB |
Output is correct |
21 |
Correct |
26 ms |
1884 KB |
Output is correct |
22 |
Correct |
25 ms |
1880 KB |
Output is correct |
23 |
Correct |
29 ms |
1880 KB |
Output is correct |
24 |
Correct |
31 ms |
1884 KB |
Output is correct |
25 |
Correct |
9 ms |
1884 KB |
Output is correct |
26 |
Correct |
30 ms |
1884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
604 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
0 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
20 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1628 KB |
Output is correct |
16 |
Correct |
8 ms |
984 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
26 ms |
1884 KB |
Output is correct |
19 |
Correct |
9 ms |
1884 KB |
Output is correct |
20 |
Correct |
29 ms |
1908 KB |
Output is correct |
21 |
Correct |
26 ms |
1884 KB |
Output is correct |
22 |
Correct |
25 ms |
1880 KB |
Output is correct |
23 |
Correct |
29 ms |
1880 KB |
Output is correct |
24 |
Correct |
31 ms |
1884 KB |
Output is correct |
25 |
Correct |
9 ms |
1884 KB |
Output is correct |
26 |
Correct |
30 ms |
1884 KB |
Output is correct |
27 |
Execution timed out |
1076 ms |
9044 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |