#include <bits/stdc++.h>
using namespace std;
const int MAXH = 3000;
string v[MAXH];
int ingots[MAXH];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int h, w, i, j, orbs;
long long ans;
cin >> h >> w;
for(i = 0; i < h; i++){
cin >> v[i];
}
ans = 0;
for(i = h - 1; i >= 0; i--){
orbs = 0;
for(j = w - 1; j >= 0; j--){
switch(v[i][j]){
case 'O':
++orbs;
break;
case 'I':
++ingots[i];
break;
case 'J':
ans += 1LL * orbs * ingots[i];
break;
}
}
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |