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 ar array
#define int long long
signed main(){
ios::sync_with_stdio(0); cin.tie(0);
int n, m; cin>>n>>m;
vector<string> a(n);
for(int i=0;i<n;i++) cin>>a[i];
vector<int> row(n), col(m);
int res = 0;
for(int i=n-1;~i;i--){
for(int j=m-1;~j;j--){
if(a[i][j] == 'J'){
res += row[i] * col[j];
}
if(a[i][j] == 'O') row[i]++;
if(a[i][j] == 'I') col[j]++;
}
}
cout<<res<<"\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |