#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ll n,m,ans = 0;
cin>>n>>m;
ll a[m] = {0};
for(ll i = 0;i < n;i++)
{
string s;
cin>>s;
ll k = 0;
for(ll j = m-1;j >= 0;j--)
{
if(s[j] == 'O')k++;
else if(s[j] == 'J')a[j] += k;
else ans += a[j];
}
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 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 |
212 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 |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 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 |
212 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 |
212 KB |
Output is correct |
14 |
Correct |
6 ms |
296 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
3 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
7 ms |
212 KB |
Output is correct |
19 |
Correct |
6 ms |
212 KB |
Output is correct |
20 |
Correct |
6 ms |
212 KB |
Output is correct |
21 |
Correct |
8 ms |
212 KB |
Output is correct |
22 |
Correct |
6 ms |
212 KB |
Output is correct |
23 |
Correct |
6 ms |
296 KB |
Output is correct |
24 |
Correct |
7 ms |
212 KB |
Output is correct |
25 |
Correct |
5 ms |
212 KB |
Output is correct |
26 |
Correct |
6 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 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 |
212 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 |
212 KB |
Output is correct |
14 |
Correct |
6 ms |
296 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
3 ms |
212 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
7 ms |
212 KB |
Output is correct |
19 |
Correct |
6 ms |
212 KB |
Output is correct |
20 |
Correct |
6 ms |
212 KB |
Output is correct |
21 |
Correct |
8 ms |
212 KB |
Output is correct |
22 |
Correct |
6 ms |
212 KB |
Output is correct |
23 |
Correct |
6 ms |
296 KB |
Output is correct |
24 |
Correct |
7 ms |
212 KB |
Output is correct |
25 |
Correct |
5 ms |
212 KB |
Output is correct |
26 |
Correct |
6 ms |
212 KB |
Output is correct |
27 |
Correct |
223 ms |
300 KB |
Output is correct |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
29 |
Correct |
17 ms |
316 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
165 ms |
300 KB |
Output is correct |
32 |
Correct |
180 ms |
304 KB |
Output is correct |
33 |
Correct |
177 ms |
304 KB |
Output is correct |
34 |
Correct |
194 ms |
296 KB |
Output is correct |
35 |
Correct |
187 ms |
332 KB |
Output is correct |
36 |
Correct |
176 ms |
304 KB |
Output is correct |
37 |
Correct |
240 ms |
308 KB |
Output is correct |
38 |
Correct |
128 ms |
300 KB |
Output is correct |
39 |
Correct |
125 ms |
212 KB |
Output is correct |