#include <iostream>
using namespace std;
int h, w;
long long cntfin;
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];
}
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
600 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
1 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
600 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
1 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 |
27 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1628 KB |
Output is correct |
16 |
Correct |
15 ms |
1112 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
37 ms |
1908 KB |
Output is correct |
19 |
Correct |
14 ms |
2136 KB |
Output is correct |
20 |
Correct |
46 ms |
1884 KB |
Output is correct |
21 |
Correct |
39 ms |
1884 KB |
Output is correct |
22 |
Correct |
39 ms |
1884 KB |
Output is correct |
23 |
Correct |
47 ms |
1884 KB |
Output is correct |
24 |
Correct |
45 ms |
1880 KB |
Output is correct |
25 |
Correct |
12 ms |
1884 KB |
Output is correct |
26 |
Correct |
45 ms |
1884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 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 |
600 KB |
Output is correct |
9 |
Correct |
0 ms |
604 KB |
Output is correct |
10 |
Correct |
1 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 |
27 ms |
1884 KB |
Output is correct |
15 |
Correct |
1 ms |
1628 KB |
Output is correct |
16 |
Correct |
15 ms |
1112 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
37 ms |
1908 KB |
Output is correct |
19 |
Correct |
14 ms |
2136 KB |
Output is correct |
20 |
Correct |
46 ms |
1884 KB |
Output is correct |
21 |
Correct |
39 ms |
1884 KB |
Output is correct |
22 |
Correct |
39 ms |
1884 KB |
Output is correct |
23 |
Correct |
47 ms |
1884 KB |
Output is correct |
24 |
Correct |
45 ms |
1880 KB |
Output is correct |
25 |
Correct |
12 ms |
1884 KB |
Output is correct |
26 |
Correct |
45 ms |
1884 KB |
Output is correct |
27 |
Execution timed out |
1068 ms |
9184 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |