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>
#define endl '\n'
using namespace std;
long long red,col,bro[3005][3005],bri[3005][3005],br=0;
char c[3005][3005];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>red>>col;
for(long long i=0;i<red;i++)
{
for(long long j=0;j<col;j++)
{
cin>>c[i][j];
}
}
for(long long i=0;i<red;i++)
{
for(long long j=col-1;j>=0;j--)
{
if(c[i][j]=='O') bro[i][j]++;
bro[i][j]+=bro[i][j+1];
}
}
for(long long i=0;i<col;i++)
{
for(long long j=red-1;j>=0;j--)
{
if(c[j][i]=='I') bri[j][i]++;
bri[j][i]+=bri[j+1][i];
}
}
for(long long i=0;i<red;i++)
{
for(long long j=0;j<col;j++)
{
if(c[i][j]=='J') br+=(bro[i][j+1]*bri[i+1][j]);
}
}
cout<<br<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |