제출 #57475

#제출 시각아이디문제언어결과실행 시간메모리
57475eric4266조개 줍기 (KOI17_shell)C++14
12 / 100
2087 ms23124 KiB
#include <stdio.h>
#define max(a,b) ((a)>(b)?(a):(b))

int A[1501][1501];
int DP[1501][1501];
int n,sum1;
int sum()
{
    sum1=0;
    int i,j;
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=n; j++)
        {
            sum1+=DP[i][j];
        }
    }
    return sum1;
}

int main()
{
    int i,j,k,a,x,y;
    char pm;
    scanf("%d",&n);
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=n; j++)
        {
            scanf("%d",&A[i][j]);
        }
    }
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=n; j++)
        {
            DP[i][j]=max(DP[i-1][j],DP[i][j-1])+A[i][j];

        }
    }
    printf("%d\n",sum());

    for(i=1; i<=n; i++)
    {
        scanf(" %c%d%d",&pm,&x,&y);
        if(pm=='U')
        {
            A[x][y]++;
        }
        else
            A[x][y]--;
        for(k=x; k<=n; k++)
        {
            for(j=y; j<=n; j++)
            {
                DP[k][j]=max(DP[k-1][j],DP[k][j-1])+A[k][j];

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

컴파일 시 표준 에러 (stderr) 메시지

shell.cpp: In function 'int main()':
shell.cpp:23:15: warning: unused variable 'a' [-Wunused-variable]
     int i,j,k,a,x,y;
               ^
shell.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
shell.cpp:30:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&A[i][j]);
             ~~~~~^~~~~~~~~~~~~~~
shell.cpp:45:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf(" %c%d%d",&pm,&x,&y);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...