#include<bits/stdc++.h>
using namespace std;
int main () {
int h, w;
cin >> h >> w;
string v[h];
for(int i = 0;i<h;i++)cin>>v[i];
int cnt[w] = {0}, ans = 0, k = 0;
for(int i = h-1;i>=0;i--) {
k = 0;
for(int j = w-1;j>=0;j--) {
if(v[i][j] == 'J')ans+=cnt[j]*k;
else if(v[i][j] == 'I')k++;
else cnt[j]++;
}
}
cout<<ans<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
216 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
216 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
216 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |