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 <iostream>
using namespace std;
long long n,m,ans;
string s[3005];
long long dpR[3005][3005];
long long dpD[3005][3005];
int main()
{
cin>>n>>m;
for(int i=0;i<n;i++)
cin>>s[i];
for(int i=n-1;i>=0;i--)
for(int j=m-1;j>=0;j--)
{
dpR[i][j]=dpR[i][j+1] + (s[i][j] == 'O');
dpD[i][j]=dpD[i+1][j] + (s[i][j] == 'I');
if(s[i][j] == 'J')
ans += dpR[i][j] * dpD[i][j];
}
cout<<ans;
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... |