This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define LL long long
LL n, m, br, lo[3009][3009], li[3009][3009];
char zad[3009][3009];
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> m;
for(int i=0; i<n; i++) for(int j=0; j<m; j++) cin >> zad[i][j];
for(int i=0; i<n; i++){
br = 0;
for(int j=m-1; j >= 0; j--){
if (zad[i][j] == 'O') br++;
lo[i][j] = br;
}
}
for(int j=0; j<m; j++){
br = 0;
for(int i=n-1; i >= 0; i--){
if (zad[i][j] == 'I') br++;
li[i][j] = br;
}
}
br = 0;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if (zad[i][j] == 'J') br += lo[i][j] * li[i][j];
}
}
cout << br; return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |