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;
char s[3001][3001];
int main()
{
cin>>h>>w;
for(int i=1; i<=h; i++)
{
for(int j=1; j<=w; j++)
cin>>s[i][j];
}
for(int i=1; i<=h; i++)
{
for(int j=1; j<=w; j++)
{
if(s[i][j]=='J')
{
int ocnt=0, icnt=0;
for(int l=j+1; l<=w; l++)
{
if(s[i][l]=='O')
ocnt++;
}
for(int k=i+1; k<=h; k++)
{
if(s[k][j]=='I')
icnt++;
}
cntfin+=ocnt*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... |