# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
920657 | rainboy | 조개 줍기 (KOI17_shell) | C++17 | 178 ms | 35668 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 N 1500
int max(int a, int b) { return a > b ? a : b; }
int main() {
static int aa[N][N], dp[N][N], dd[N][N];
int n, h, i, il, ir, j, jl, jr;
long long sum;
scanf("%d", &n);
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
scanf("%d", &aa[i][j]);
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
dp[i][j] = (i == 0 && j == 0 ? 0 : max(i == 0 ? -1 : dp[i - 1][j], j == 0 ? -1 : dp[i][j - 1])) + aa[i][j];
sum = 0;
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
sum += dp[i][j];
for (i = 0; i < n; i++)
for (j = 0; j < n; j++)
if (i + 1 < n && j > 0)
dd[i][j] = dp[i][j] - dp[i + 1][j - 1];
printf("%lld\n", sum);
for (h = 0; h < n; h++) {
static char s[2];
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... |