#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 3003;
char a[N][N];
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
for(int i=0; i< n; i++){
for(int j=0; j< m; j++){
cin >> a[i][j];
}
}
int rows[n]={0};
int cols[m]={0};
int ans=0;
for(int i=n-1; i>=0; i--){
for(int j=m-1; j>=0; j--){
if(a[i][j]=='O'){
rows[i]++;
}
else if(a[i][j]=='I'){
cols[j]++;
}
else ans+=rows[i]*cols[j];
}
}
cout << ans << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 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 |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2648 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2652 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2652 KB |
Output is correct |
13 |
Correct |
1 ms |
2648 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 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 |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2648 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2652 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2652 KB |
Output is correct |
13 |
Correct |
1 ms |
2648 KB |
Output is correct |
14 |
Correct |
3 ms |
2652 KB |
Output is correct |
15 |
Correct |
0 ms |
2652 KB |
Output is correct |
16 |
Correct |
2 ms |
2652 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
6 ms |
2696 KB |
Output is correct |
19 |
Correct |
3 ms |
2648 KB |
Output is correct |
20 |
Correct |
3 ms |
2652 KB |
Output is correct |
21 |
Correct |
4 ms |
2908 KB |
Output is correct |
22 |
Correct |
3 ms |
2908 KB |
Output is correct |
23 |
Correct |
3 ms |
2908 KB |
Output is correct |
24 |
Correct |
5 ms |
2944 KB |
Output is correct |
25 |
Correct |
3 ms |
2908 KB |
Output is correct |
26 |
Correct |
3 ms |
2908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 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 |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2648 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2652 KB |
Output is correct |
10 |
Correct |
1 ms |
2652 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2652 KB |
Output is correct |
13 |
Correct |
1 ms |
2648 KB |
Output is correct |
14 |
Correct |
3 ms |
2652 KB |
Output is correct |
15 |
Correct |
0 ms |
2652 KB |
Output is correct |
16 |
Correct |
2 ms |
2652 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
6 ms |
2696 KB |
Output is correct |
19 |
Correct |
3 ms |
2648 KB |
Output is correct |
20 |
Correct |
3 ms |
2652 KB |
Output is correct |
21 |
Correct |
4 ms |
2908 KB |
Output is correct |
22 |
Correct |
3 ms |
2908 KB |
Output is correct |
23 |
Correct |
3 ms |
2908 KB |
Output is correct |
24 |
Correct |
5 ms |
2944 KB |
Output is correct |
25 |
Correct |
3 ms |
2908 KB |
Output is correct |
26 |
Correct |
3 ms |
2908 KB |
Output is correct |
27 |
Correct |
123 ms |
18004 KB |
Output is correct |
28 |
Correct |
1 ms |
8796 KB |
Output is correct |
29 |
Correct |
7 ms |
3164 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
88 ms |
14976 KB |
Output is correct |
32 |
Correct |
90 ms |
18044 KB |
Output is correct |
33 |
Correct |
93 ms |
18156 KB |
Output is correct |
34 |
Correct |
106 ms |
15956 KB |
Output is correct |
35 |
Correct |
97 ms |
18008 KB |
Output is correct |
36 |
Correct |
83 ms |
18004 KB |
Output is correct |
37 |
Correct |
132 ms |
18156 KB |
Output is correct |
38 |
Correct |
64 ms |
14932 KB |
Output is correct |
39 |
Correct |
61 ms |
14932 KB |
Output is correct |