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;
char mat[3003][3003];
int spo[3003][3003], spi[3003][3003];
int main()
{
int n, m;
cin>>n>>m;
for(int i=1; i<=n; i++)
{
for(int j=1; j<=m; j++)
{
cin>>mat[i][j];
spo[i][j]=spo[i][j-1]+(mat[i][j]=='O');
spi[i][j]=spi[i-1][j]+(mat[i][j]=='I');
}
}
long long cnt=0;
for(int i=1; i<=n; i++)
{
for(int j=1; j<=m; j++)
{
if(mat[i][j]=='J')
{
cnt+=(spo[i][m]-spo[i][j])*(spi[n][j]-spi[i][j]);
}
}
}
cout<<cnt;
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... |