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;
int h, w;
long long cntfin;
int ocnts[3001];
char s[3001][3001];
int main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
cin>>h>>w;
for(int i=1; i<=h; i++)
{
for(int j=1; j<=w; j++)
{
cin>>s[i][j];
if(s[i][j]=='O')
ocnts[i]++;
}
}
for(int i=1; i<=h; i++)
{
for(int j=1; j<=w; j++)
{
if(s[i][j]=='O')
ocnts[i]--;
if(s[i][j]=='J')
{
int icnt=0;
for(int k=i+1; k<=h; k++)
{
if(s[k][j]=='I')
icnt++;
}
cntfin+=ocnts[i]*icnt;
}
}
}
cout<<cntfin;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |