#include <bits/stdc++.h>
using namespace std;
const int nx=3e3+100;
long long h, w, dpr[nx], dpc[nx], ans;
char c[nx][nx];
vector<pair<int, int>> v;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>h>>w;
for (int i=1; i<=h; i++) for (int j=1; j<=w; j++) cin>>c[i][j];
for (int i=h; i>=1; i--)
{
for (int j=w; j>=1; j--)
{
if (c[i][j]=='J') ans+=dpc[j]*dpr[i];
if (c[i][j]=='O') dpr[i]++;
if (c[i][j]=='I') dpc[j]++;
}
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
596 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
596 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
592 KB |
Output is correct |
13 |
Correct |
1 ms |
596 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
596 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
596 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
592 KB |
Output is correct |
13 |
Correct |
1 ms |
596 KB |
Output is correct |
14 |
Correct |
4 ms |
2004 KB |
Output is correct |
15 |
Correct |
1 ms |
1620 KB |
Output is correct |
16 |
Correct |
2 ms |
1236 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
4 ms |
2004 KB |
Output is correct |
19 |
Correct |
4 ms |
2004 KB |
Output is correct |
20 |
Correct |
3 ms |
2004 KB |
Output is correct |
21 |
Correct |
5 ms |
2028 KB |
Output is correct |
22 |
Correct |
5 ms |
2004 KB |
Output is correct |
23 |
Correct |
4 ms |
2004 KB |
Output is correct |
24 |
Correct |
5 ms |
2004 KB |
Output is correct |
25 |
Correct |
4 ms |
2004 KB |
Output is correct |
26 |
Correct |
4 ms |
2020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
596 KB |
Output is correct |
6 |
Correct |
1 ms |
596 KB |
Output is correct |
7 |
Correct |
1 ms |
596 KB |
Output is correct |
8 |
Correct |
1 ms |
596 KB |
Output is correct |
9 |
Correct |
1 ms |
596 KB |
Output is correct |
10 |
Correct |
1 ms |
596 KB |
Output is correct |
11 |
Correct |
1 ms |
596 KB |
Output is correct |
12 |
Correct |
1 ms |
592 KB |
Output is correct |
13 |
Correct |
1 ms |
596 KB |
Output is correct |
14 |
Correct |
4 ms |
2004 KB |
Output is correct |
15 |
Correct |
1 ms |
1620 KB |
Output is correct |
16 |
Correct |
2 ms |
1236 KB |
Output is correct |
17 |
Correct |
1 ms |
332 KB |
Output is correct |
18 |
Correct |
4 ms |
2004 KB |
Output is correct |
19 |
Correct |
4 ms |
2004 KB |
Output is correct |
20 |
Correct |
3 ms |
2004 KB |
Output is correct |
21 |
Correct |
5 ms |
2028 KB |
Output is correct |
22 |
Correct |
5 ms |
2004 KB |
Output is correct |
23 |
Correct |
4 ms |
2004 KB |
Output is correct |
24 |
Correct |
5 ms |
2004 KB |
Output is correct |
25 |
Correct |
4 ms |
2004 KB |
Output is correct |
26 |
Correct |
4 ms |
2020 KB |
Output is correct |
27 |
Correct |
130 ms |
17680 KB |
Output is correct |
28 |
Correct |
3 ms |
7380 KB |
Output is correct |
29 |
Correct |
7 ms |
1740 KB |
Output is correct |
30 |
Correct |
1 ms |
340 KB |
Output is correct |
31 |
Correct |
91 ms |
14044 KB |
Output is correct |
32 |
Correct |
91 ms |
18252 KB |
Output is correct |
33 |
Correct |
93 ms |
18124 KB |
Output is correct |
34 |
Correct |
108 ms |
16156 KB |
Output is correct |
35 |
Correct |
89 ms |
18096 KB |
Output is correct |
36 |
Correct |
84 ms |
18104 KB |
Output is correct |
37 |
Correct |
131 ms |
18248 KB |
Output is correct |
38 |
Correct |
61 ms |
13912 KB |
Output is correct |
39 |
Correct |
59 ms |
13944 KB |
Output is correct |