# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
403693 | 2021-05-13T11:21:02 Z | joelau | None (KOI17_shell) | C++14 | 13 ms | 632 KB |
#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; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 332 KB | Output is correct |
2 | Correct | 6 ms | 332 KB | Output is correct |
3 | Correct | 6 ms | 332 KB | Output is correct |
4 | Correct | 7 ms | 332 KB | Output is correct |
5 | Correct | 7 ms | 316 KB | Output is correct |
6 | Correct | 6 ms | 332 KB | Output is correct |
7 | Correct | 6 ms | 312 KB | Output is correct |
8 | Correct | 6 ms | 332 KB | Output is correct |
9 | Correct | 7 ms | 392 KB | Output is correct |
10 | Correct | 7 ms | 316 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 13 ms | 632 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 332 KB | Output is correct |
2 | Correct | 6 ms | 332 KB | Output is correct |
3 | Correct | 6 ms | 332 KB | Output is correct |
4 | Correct | 7 ms | 332 KB | Output is correct |
5 | Correct | 7 ms | 316 KB | Output is correct |
6 | Correct | 6 ms | 332 KB | Output is correct |
7 | Correct | 6 ms | 312 KB | Output is correct |
8 | Correct | 6 ms | 332 KB | Output is correct |
9 | Correct | 7 ms | 392 KB | Output is correct |
10 | Incorrect | 13 ms | 632 KB | Output isn't correct |
11 | Halted | 0 ms | 0 KB | - |