Submission #1099361

#TimeUsernameProblemLanguageResultExecution timeMemory
1099361andreiqwerBitaro the Brave (JOI19_ho_t1)C++17
50 / 100
1068 ms9184 KiB
#include <iostream>

using namespace std;

int h, w;
long long cntfin;
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];
    }

    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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...