# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
403693 | joelau | 조개 줍기 (KOI17_shell) | C++14 | 13 ms | 632 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int N, A[100][100], dp[100][100];
int main() {
scanf("%d", &N);
for (int i = 0; i < N; ++i) for (int j = 0; j < N; ++j) scanf("%d", &A[i][j]);
long long ans = 0;
for (int i = 0; i < N; ++i) for (int j = 0; j < N; ++j) {
dp[i][j] = 0;
if (i != 0) dp[i][j] = max(dp[i][j],dp[i-1][j]);
if (j != 0) dp[i][j] = max(dp[i][j],dp[i][j-1]);
dp[i][j] += A[i][j];
ans += dp[i][j];
}
printf("%lld\n", ans);
for (int a = 0; a < N; ++a) {
char c; int x,y; scanf(" %c %d %d", &c, &x, &y), x--, y--;
if (c == 'U') A[x][y]++;
else A[x][y]--;
long long ans = 0;
for (int i = 0; i < N; ++i) for (int j = 0; j < N; ++j) {
dp[i][j] = 0;
if (i != 0) dp[i][j] = max(dp[i][j],dp[i-1][j]);
if (j != 0) dp[i][j] = max(dp[i][j],dp[i][j-1]);
dp[i][j] += A[i][j];
ans += dp[i][j];
}
printf("%lld\n", ans);
}
return 0;
}
컴파일 시 표준 에러 (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... |