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>
#include <fstream>
using namespace std;
int lin[3005],col[3005];
string s[3005];
int n,m,i,j;
long long ans;
int main()
{
//freopen("data.in","r",stdin);
ios_base::sync_with_stdio(false);
cin>>n>>m;
for(i=1;i<=n;i++)
{
cin>>s[i];
s[i]=' '+s[i];
}
for(i=n;i>=1;i--)
for(j=m;j>=1;j--)
{
if(s[i][j]=='O') lin[i]++;
if(s[i][j]=='I') col[j]++;
if(s[i][j]=='J')
ans+=1LL*lin[i]*col[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... |