# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
57475 | eric4266 | 조개 줍기 (KOI17_shell) | C++14 | 2087 ms | 23124 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |