#include <bits/stdc++.h>
using namespace std;
int main() {
int H, W;
long long T=0;
cin >> H >> W;
string s;
long long c[W];
fill(c, c+W, 0LL);
for (int i=0;i<H;i++) {
cin >> s;
int k=0;
for (int j=W-1;j>=0;j--) {
if (s[j]=='J') {
c[j]+=(long long)k;
}
else if (s[j]=='O') {
k++;
}
else if (s[j]=='I') {
T+=c[j];
}
}
}
cout << T;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
4 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
300 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
5 ms |
256 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
4 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
300 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
5 ms |
256 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
16 ms |
256 KB |
Output is correct |
15 |
Correct |
6 ms |
256 KB |
Output is correct |
16 |
Correct |
11 ms |
256 KB |
Output is correct |
17 |
Correct |
5 ms |
256 KB |
Output is correct |
18 |
Correct |
18 ms |
256 KB |
Output is correct |
19 |
Correct |
16 ms |
256 KB |
Output is correct |
20 |
Correct |
16 ms |
376 KB |
Output is correct |
21 |
Correct |
19 ms |
504 KB |
Output is correct |
22 |
Correct |
17 ms |
504 KB |
Output is correct |
23 |
Correct |
17 ms |
504 KB |
Output is correct |
24 |
Correct |
18 ms |
504 KB |
Output is correct |
25 |
Correct |
17 ms |
632 KB |
Output is correct |
26 |
Correct |
16 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
256 KB |
Output is correct |
4 |
Correct |
4 ms |
256 KB |
Output is correct |
5 |
Correct |
5 ms |
300 KB |
Output is correct |
6 |
Correct |
5 ms |
256 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
5 ms |
256 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
256 KB |
Output is correct |
12 |
Correct |
5 ms |
256 KB |
Output is correct |
13 |
Correct |
5 ms |
376 KB |
Output is correct |
14 |
Correct |
16 ms |
256 KB |
Output is correct |
15 |
Correct |
6 ms |
256 KB |
Output is correct |
16 |
Correct |
11 ms |
256 KB |
Output is correct |
17 |
Correct |
5 ms |
256 KB |
Output is correct |
18 |
Correct |
18 ms |
256 KB |
Output is correct |
19 |
Correct |
16 ms |
256 KB |
Output is correct |
20 |
Correct |
16 ms |
376 KB |
Output is correct |
21 |
Correct |
19 ms |
504 KB |
Output is correct |
22 |
Correct |
17 ms |
504 KB |
Output is correct |
23 |
Correct |
17 ms |
504 KB |
Output is correct |
24 |
Correct |
18 ms |
504 KB |
Output is correct |
25 |
Correct |
17 ms |
632 KB |
Output is correct |
26 |
Correct |
16 ms |
632 KB |
Output is correct |
27 |
Correct |
472 ms |
8696 KB |
Output is correct |
28 |
Correct |
7 ms |
376 KB |
Output is correct |
29 |
Correct |
36 ms |
1016 KB |
Output is correct |
30 |
Correct |
6 ms |
376 KB |
Output is correct |
31 |
Correct |
344 ms |
6396 KB |
Output is correct |
32 |
Correct |
446 ms |
9080 KB |
Output is correct |
33 |
Correct |
430 ms |
9080 KB |
Output is correct |
34 |
Correct |
402 ms |
7416 KB |
Output is correct |
35 |
Correct |
447 ms |
9080 KB |
Output is correct |
36 |
Correct |
431 ms |
9208 KB |
Output is correct |
37 |
Correct |
499 ms |
9080 KB |
Output is correct |
38 |
Correct |
304 ms |
6520 KB |
Output is correct |
39 |
Correct |
301 ms |
6392 KB |
Output is correct |