Submission #484178

# Submission time Handle Problem Language Result Execution time Memory
484178 2021-11-02T09:44:30 Z ToroTN Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
1 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
int n,m,c[3005][3005][2],r[3005][3005][2];
long long cnt=0;
char s[3005][3005];
int main()
{
    scanf("%lld%lld",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%s",s[i]+1);
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(s[i][j]=='O')
            {
                c[i][j][0]=c[i-1][j][0]+1;
                r[i][j][0]=r[i][j-1][0]+1;
            }else
            {
                c[i][j][0]=c[i-1][j][0];
                r[i][j][0]=r[i][j-1][0];
            }
            if(s[i][j]=='I')
            {
                c[i][j][1]=c[i-1][j][1]+1;
                r[i][j][1]=r[i][j-1][1]+1;
            }else
            {
                c[i][j][1]=c[i-1][j][1];
                r[i][j][1]=r[i][j-1][1];
            }
        }
    }
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            if(s[i][j]=='J')
            {
                //cnt+=(c[n][j][0]-c[i][j][0])*(r[i][m][1]-r[i][j][1]);
                cnt+=(long long)(c[n][j][1]-c[i][j][1])*(r[i][m][0]-r[i][j][0]);
            }
        }
    }
    printf("%lld\n",cnt);
}

Compilation message

joi2019_ho_t1.cpp: In function 'int main()':
joi2019_ho_t1.cpp:8:15: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
    8 |     scanf("%lld%lld",&n,&m);
      |            ~~~^      ~~
      |               |      |
      |               |      int*
      |               long long int*
      |            %d
joi2019_ho_t1.cpp:8:19: warning: format '%lld' expects argument of type 'long long int*', but argument 3 has type 'int*' [-Wformat=]
    8 |     scanf("%lld%lld",&n,&m);
      |                ~~~^     ~~
      |                   |     |
      |                   |     int*
      |                   long long int*
      |                %d
joi2019_ho_t1.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%lld%lld",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%s",s[i]+1);
      |         ~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -