Submission #582700

#TimeUsernameProblemLanguageResultExecution timeMemory
582700hibikiBitaro the Brave (JOI19_ho_t1)C++11
100 / 100
236 ms53252 KiB
#include<bits/stdc++.h>
using namespace std;

int h,w;
char wd[3005][3005];
int orb[3005][3005];
long long ans = 0;

int main()
{
    scanf("%d %d",&h,&w);
    for(int i = 0; i < h; i++)
    {
        scanf("%s",wd[i]);
        for(int j = w - 1; j >= 0; j--)
        {
            orb[i][j] = orb[i][j + 1];
            if(wd[i][j] == 'O')
                orb[i][j]++;
        }
    }
    for(int j = 0; j < w; j++)
    {
        int in = 0;
        for(int i = h - 1; i >= 0; i--)
        {
            if(wd[i][j] == 'I') in++;
            if(wd[i][j] == 'J') ans += in * orb[i][j];
        }
    }
    printf("%lld\n",ans);
    return 0;
}

Compilation message (stderr)

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