#include <bits/stdc++.h>
using namespace std;
#include "wombats.h"
const int M = 5000;
const int N = 200;
int R, C;
int H[M][N], V[M][N];
void init(int _R, int _C, int _H[5000][200], int _V[5000][200]) {
R = _R;
C = _C;
for (int i = 0; i < R; i++)
for (int j = 0; j < C - 1; j++)
H[i][j] = _H[i][j];
for (int i = 0; i < R - 1; i++)
for (int j = 0; j < C; j++)
V[i][j] = _V[i][j];
}
void changeH(int P, int Q, int W) {
H[P][Q] = W;
}
void changeV(int P, int Q, int W) {
V[P][Q] = W;
}
int escape(int a, int b) {
int dp[1000];
for (int &x : dp) x = 1e9;
dp[a] = 0;
for (int i = 0; i < R - 1; i++) {
for (int j = 0; i && j < C; j++)
dp[j] += V[i - 1][j];
for (int j = 0; j < C - 1; j++)
dp[j + 1] = min(dp[j + 1], dp[j] + H[i][j]);
for (int j = C - 2; j >= 0; j--)
dp[j] = min(dp[j], dp[j + 1] + H[i][j]);
}
return dp[b];
}
Compilation message
grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
15 | int res;
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
8396 KB |
Output is correct |
2 |
Incorrect |
9 ms |
8284 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
52 ms |
15960 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |