#include <bits/stdc++.h>
using namespace std;
int main(){
int h,w;cin>>h>>w;
int o[h];int n[w];char g[h][w];
memset(o,0,sizeof(o));memset(n,0,sizeof(n));
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
cin>>g[i][j];
if(g[i][j]=='O')o[i]++;
if(g[i][j]=='I')n[j]++;
}
}
unsigned long long t=0;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if(g[i][j]=='J')t+=o[i]*n[j];
if(g[i][j]=='O')o[i]--;
if(g[i][j]=='I')n[j]--;
}
}
cout<<t<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
15 ms |
460 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
9 ms |
412 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
21 ms |
528 KB |
Output is correct |
19 |
Correct |
17 ms |
524 KB |
Output is correct |
20 |
Correct |
16 ms |
524 KB |
Output is correct |
21 |
Correct |
20 ms |
768 KB |
Output is correct |
22 |
Correct |
17 ms |
716 KB |
Output is correct |
23 |
Correct |
17 ms |
764 KB |
Output is correct |
24 |
Correct |
20 ms |
776 KB |
Output is correct |
25 |
Correct |
17 ms |
844 KB |
Output is correct |
26 |
Correct |
17 ms |
764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
9 |
Correct |
1 ms |
204 KB |
Output is correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
15 ms |
460 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
9 ms |
412 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
21 ms |
528 KB |
Output is correct |
19 |
Correct |
17 ms |
524 KB |
Output is correct |
20 |
Correct |
16 ms |
524 KB |
Output is correct |
21 |
Correct |
20 ms |
768 KB |
Output is correct |
22 |
Correct |
17 ms |
716 KB |
Output is correct |
23 |
Correct |
17 ms |
764 KB |
Output is correct |
24 |
Correct |
20 ms |
776 KB |
Output is correct |
25 |
Correct |
17 ms |
844 KB |
Output is correct |
26 |
Correct |
17 ms |
764 KB |
Output is correct |
27 |
Correct |
669 ms |
16908 KB |
Output is correct |
28 |
Correct |
3 ms |
332 KB |
Output is correct |
29 |
Correct |
43 ms |
1556 KB |
Output is correct |
30 |
Correct |
2 ms |
332 KB |
Output is correct |
31 |
Correct |
534 ms |
12400 KB |
Output is correct |
32 |
Correct |
609 ms |
17844 KB |
Output is correct |
33 |
Correct |
576 ms |
17752 KB |
Output is correct |
34 |
Correct |
591 ms |
14404 KB |
Output is correct |
35 |
Correct |
653 ms |
17720 KB |
Output is correct |
36 |
Correct |
576 ms |
17748 KB |
Output is correct |
37 |
Correct |
749 ms |
17780 KB |
Output is correct |
38 |
Correct |
420 ms |
12352 KB |
Output is correct |
39 |
Correct |
426 ms |
12372 KB |
Output is correct |