#include <iostream>
using namespace std;
int main(){
int n, m; cin >> n >> m;
string g[n];
for (int i = 0; i < n; i++){
cin >> g[i];
}
int cntO[n]{}, cntI[m]{};
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
if (g[i][j] == 'O'){
cntO[i]++;
}
if (g[i][j] == 'I'){
cntI[j]++;
}
}
}
long long ans = 0;
for (int i = 0; i < n; i++){
for (int j = 0; j < m; j++){
if (g[i][j] == 'O'){
cntO[i]--;
}
if (g[i][j] == 'I'){
cntI[j]--;
}
if (g[i][j] == 'J'){
ans += cntO[i] * cntI[j];
}
}
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
0 ms |
300 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
312 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
312 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
0 ms |
300 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
312 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
312 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
7 ms |
692 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
4 ms |
596 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
9 ms |
980 KB |
Output is correct |
19 |
Correct |
6 ms |
688 KB |
Output is correct |
20 |
Correct |
7 ms |
1012 KB |
Output is correct |
21 |
Correct |
10 ms |
980 KB |
Output is correct |
22 |
Correct |
6 ms |
724 KB |
Output is correct |
23 |
Correct |
6 ms |
980 KB |
Output is correct |
24 |
Correct |
9 ms |
1032 KB |
Output is correct |
25 |
Correct |
6 ms |
688 KB |
Output is correct |
26 |
Correct |
6 ms |
952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
0 ms |
300 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
312 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
312 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
7 ms |
692 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
4 ms |
596 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
9 ms |
980 KB |
Output is correct |
19 |
Correct |
6 ms |
688 KB |
Output is correct |
20 |
Correct |
7 ms |
1012 KB |
Output is correct |
21 |
Correct |
10 ms |
980 KB |
Output is correct |
22 |
Correct |
6 ms |
724 KB |
Output is correct |
23 |
Correct |
6 ms |
980 KB |
Output is correct |
24 |
Correct |
9 ms |
1032 KB |
Output is correct |
25 |
Correct |
6 ms |
688 KB |
Output is correct |
26 |
Correct |
6 ms |
952 KB |
Output is correct |
27 |
Correct |
273 ms |
19916 KB |
Output is correct |
28 |
Correct |
2 ms |
308 KB |
Output is correct |
29 |
Correct |
15 ms |
1844 KB |
Output is correct |
30 |
Correct |
1 ms |
308 KB |
Output is correct |
31 |
Correct |
208 ms |
16076 KB |
Output is correct |
32 |
Correct |
206 ms |
20376 KB |
Output is correct |
33 |
Correct |
202 ms |
20428 KB |
Output is correct |
34 |
Correct |
240 ms |
18412 KB |
Output is correct |
35 |
Correct |
205 ms |
20424 KB |
Output is correct |
36 |
Correct |
199 ms |
20344 KB |
Output is correct |
37 |
Correct |
289 ms |
20660 KB |
Output is correct |
38 |
Correct |
148 ms |
15792 KB |
Output is correct |
39 |
Correct |
138 ms |
15820 KB |
Output is correct |