Submission #57475

# Submission time Handle Problem Language Result Execution time Memory
57475 2018-07-15T06:38:00 Z eric4266 None (KOI17_shell) C++14
12 / 100
2000 ms 23124 KB
#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;
}

Compilation message

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 time Memory Grader output
1 Correct 7 ms 1148 KB Output is correct
2 Correct 8 ms 1316 KB Output is correct
3 Correct 9 ms 1456 KB Output is correct
4 Correct 11 ms 1736 KB Output is correct
5 Correct 11 ms 1760 KB Output is correct
6 Correct 10 ms 1760 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 9 ms 1796 KB Output is correct
9 Correct 9 ms 1820 KB Output is correct
10 Correct 7 ms 1844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2087 ms 23124 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1148 KB Output is correct
2 Correct 8 ms 1316 KB Output is correct
3 Correct 9 ms 1456 KB Output is correct
4 Correct 11 ms 1736 KB Output is correct
5 Correct 11 ms 1760 KB Output is correct
6 Correct 10 ms 1760 KB Output is correct
7 Correct 11 ms 1772 KB Output is correct
8 Correct 9 ms 1796 KB Output is correct
9 Correct 9 ms 1820 KB Output is correct
10 Execution timed out 2087 ms 23124 KB Time limit exceeded
11 Halted 0 ms 0 KB -