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;
const int N=3*1e3+2;
char T[N][N];
int H[N][N],W[N][N];
int main()
{
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
cin>>T[i][j];
}
}
for(int i=1;i<=n;i++)
{
int wyn=0;
for(int j=m;j>=1;j--)
{
W[i][j]=wyn;
if(T[i][j]=='O')wyn++;
}
}
for(int j=1;j<=m;j++)
{
int wyn=0;
for(int i=n;i>=1;i--)
{
H[i][j]=wyn;
if(T[i][j]=='I')wyn++;
}
}
long long wyn=0;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(T[i][j]=='J')
{
wyn+=H[i][j]*W[i][j];
}
}
}
cout<<wyn;
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... |