답안 #484159

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
484159 2021-11-02T08:38:04 Z ToroTN Bitaro the Brave (JOI19_ho_t1) C++14
0 / 100
0 ms 332 KB
#include<bits/stdc++.h>
using namespace std;
long long n,m,c[3005][3005][2],r[3005][3005][2],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+=(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:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%lld%lld",&n,&m);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
joi2019_ho_t1.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |         scanf("%s",s[i]+1);
      |         ~~~~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -