Submission #374755

#TimeUsernameProblemLanguageResultExecution timeMemory
374755daniel920712Bitaro the Brave (JOI19_ho_t1)C++14
20 / 100
8 ms2156 KiB
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>

using namespace std;
int con1[5][3005]={0};
int con2[5][3005]={0};
char all[3005][3005];
int main()
{
    int N,M,ans=0,i,j;
    scanf("%d %d",&N,&M);
    for(i=0;i<N;i++)
    {
        scanf("%s",all[i]);
        for(j=0;j<M;j++)
        {
            if(all[i][j]=='J')
            {
                con1[0][i]++;
                con2[0][j]++;
            }
            else if(all[i][j]=='O')
            {
                con1[1][i]++;
                con2[1][j]++;
            }
            else
            {
                con1[2][i]++;
                con2[2][j]++;
            }
        }
    }
    for(i=0;i<N;i++)
    {
        for(j=0;j<M;j++)
        {


            if(all[i][j]=='J') ans+=(con1[1][i])*(con2[2][j]);

            if(all[i][j]=='J')
            {
                con1[0][i]--;
                con2[0][j]--;
            }
            else if(all[i][j]=='O')
            {
                con1[1][i]--;
                con2[1][j]--;
            }
            else
            {
                con1[2][i]--;
                con2[2][j]--;
            }


        }
    }
    printf("%d\n",ans);
    return 0;
}

Compilation message (stderr)

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |     scanf("%d %d",&N,&M);
      |     ~~~~~^~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |         scanf("%s",all[i]);
      |         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...