#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 |
12 ms |
8268 KB |
Output is correct |
2 |
Correct |
10 ms |
8308 KB |
Output is correct |
3 |
Correct |
2477 ms |
10836 KB |
Output is correct |
4 |
Correct |
20 ms |
8284 KB |
Output is correct |
5 |
Correct |
19 ms |
8304 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
512 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
528 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
348 KB |
Output is correct |
11 |
Correct |
352 ms |
2932 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
604 KB |
Output is correct |
2 |
Correct |
4 ms |
840 KB |
Output is correct |
3 |
Correct |
4 ms |
604 KB |
Output is correct |
4 |
Correct |
4 ms |
860 KB |
Output is correct |
5 |
Correct |
4 ms |
600 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
5 ms |
604 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
15964 KB |
Output is correct |
2 |
Correct |
45 ms |
16128 KB |
Output is correct |
3 |
Correct |
46 ms |
15960 KB |
Output is correct |
4 |
Correct |
3915 ms |
17388 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
604 KB |
Output is correct |
2 |
Correct |
4 ms |
844 KB |
Output is correct |
3 |
Correct |
5 ms |
604 KB |
Output is correct |
4 |
Correct |
4 ms |
604 KB |
Output is correct |
5 |
Correct |
5 ms |
604 KB |
Output is correct |
6 |
Correct |
45 ms |
15964 KB |
Output is correct |
7 |
Correct |
46 ms |
16216 KB |
Output is correct |
8 |
Correct |
44 ms |
15960 KB |
Output is correct |
9 |
Correct |
3929 ms |
17308 KB |
Output is correct |
10 |
Correct |
10 ms |
8280 KB |
Output is correct |
11 |
Correct |
10 ms |
8280 KB |
Output is correct |
12 |
Correct |
2493 ms |
10852 KB |
Output is correct |
13 |
Correct |
10 ms |
8280 KB |
Output is correct |
14 |
Correct |
9 ms |
8284 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
532 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
1 ms |
348 KB |
Output is correct |
24 |
Correct |
1 ms |
348 KB |
Output is correct |
25 |
Correct |
330 ms |
2872 KB |
Output is correct |
26 |
Correct |
1 ms |
348 KB |
Output is correct |
27 |
Correct |
6 ms |
848 KB |
Output is correct |
28 |
Execution timed out |
20084 ms |
19804 KB |
Time limit exceeded |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
604 KB |
Output is correct |
2 |
Correct |
5 ms |
848 KB |
Output is correct |
3 |
Correct |
4 ms |
600 KB |
Output is correct |
4 |
Correct |
4 ms |
604 KB |
Output is correct |
5 |
Correct |
4 ms |
860 KB |
Output is correct |
6 |
Correct |
47 ms |
15964 KB |
Output is correct |
7 |
Correct |
44 ms |
15960 KB |
Output is correct |
8 |
Correct |
44 ms |
15964 KB |
Output is correct |
9 |
Correct |
3941 ms |
17552 KB |
Output is correct |
10 |
Correct |
10 ms |
8284 KB |
Output is correct |
11 |
Correct |
9 ms |
8284 KB |
Output is correct |
12 |
Correct |
2649 ms |
10836 KB |
Output is correct |
13 |
Correct |
10 ms |
8284 KB |
Output is correct |
14 |
Correct |
10 ms |
8272 KB |
Output is correct |
15 |
Correct |
134 ms |
25684 KB |
Output is correct |
16 |
Execution timed out |
20039 ms |
23864 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |