#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
int A1[5009][209], A2[5009][209], H, W;
void init(int R, int C, int I[5000][200], int V[5000][200]) {
H = R; W = C;
for (int i = 0; i < H; i++) {
for(int j = 0; j < W - 1; j++) A1[i][j] = I[i][j];
}
for (int i = 0; i < H - 1; i++) {
for (int j = 0; j < W; j++) A2[i][j] = V[i][j];
}
}
void changeH(int P, int Q, int T) {
A1[P][Q] = T;
}
void changeV(int P, int Q, int T) {
A2[P][Q] = T;
}
int dp[5009];
int escape(int V1, int V2) {
for (int i = 0; i < W; i++) dp[i] = (1<<30);
dp[V1] = 0;
for (int t = 0; t < H; t++) {
for (int i = 0; i < W - 1; i++) dp[i + 1] = min(dp[i + 1], dp[i] + A1[t][i]);
for (int i = W - 2; i >= 0; i--) dp[i] = min(dp[i], dp[i + 1] + A1[t][i]);
for (int i = 0; i < W; i++) dp[i] += A2[t][i];
}
return dp[V2];
}
Compilation message
grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
int res;
^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
19 ms |
8448 KB |
Output is correct |
2 |
Correct |
21 ms |
8440 KB |
Output is correct |
3 |
Correct |
3698 ms |
11376 KB |
Output is correct |
4 |
Correct |
26 ms |
8440 KB |
Output is correct |
5 |
Correct |
28 ms |
8320 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
380 KB |
Output is correct |
8 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
6 |
Correct |
4 ms |
512 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
3 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
11 |
Correct |
411 ms |
2808 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
768 KB |
Output is correct |
2 |
Correct |
10 ms |
768 KB |
Output is correct |
3 |
Correct |
11 ms |
768 KB |
Output is correct |
4 |
Correct |
10 ms |
768 KB |
Output is correct |
5 |
Correct |
12 ms |
768 KB |
Output is correct |
6 |
Correct |
2 ms |
404 KB |
Output is correct |
7 |
Correct |
3 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
11 ms |
768 KB |
Output is correct |
10 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
81 ms |
16452 KB |
Output is correct |
2 |
Correct |
90 ms |
16428 KB |
Output is correct |
3 |
Correct |
69 ms |
16376 KB |
Output is correct |
4 |
Correct |
6299 ms |
18152 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
768 KB |
Output is correct |
2 |
Correct |
11 ms |
768 KB |
Output is correct |
3 |
Correct |
12 ms |
768 KB |
Output is correct |
4 |
Correct |
11 ms |
768 KB |
Output is correct |
5 |
Correct |
11 ms |
768 KB |
Output is correct |
6 |
Correct |
84 ms |
16384 KB |
Output is correct |
7 |
Correct |
90 ms |
16504 KB |
Output is correct |
8 |
Correct |
83 ms |
16532 KB |
Output is correct |
9 |
Correct |
6071 ms |
17940 KB |
Output is correct |
10 |
Correct |
17 ms |
8320 KB |
Output is correct |
11 |
Correct |
18 ms |
8448 KB |
Output is correct |
12 |
Correct |
3620 ms |
11232 KB |
Output is correct |
13 |
Correct |
19 ms |
8448 KB |
Output is correct |
14 |
Correct |
22 ms |
8448 KB |
Output is correct |
15 |
Correct |
3 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
4 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
384 KB |
Output is correct |
20 |
Correct |
4 ms |
384 KB |
Output is correct |
21 |
Correct |
4 ms |
384 KB |
Output is correct |
22 |
Correct |
3 ms |
384 KB |
Output is correct |
23 |
Correct |
4 ms |
384 KB |
Output is correct |
24 |
Correct |
3 ms |
384 KB |
Output is correct |
25 |
Correct |
427 ms |
2964 KB |
Output is correct |
26 |
Correct |
4 ms |
384 KB |
Output is correct |
27 |
Correct |
9 ms |
768 KB |
Output is correct |
28 |
Execution timed out |
20083 ms |
20268 KB |
Time limit exceeded |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
768 KB |
Output is correct |
2 |
Correct |
12 ms |
768 KB |
Output is correct |
3 |
Correct |
12 ms |
768 KB |
Output is correct |
4 |
Correct |
11 ms |
768 KB |
Output is correct |
5 |
Correct |
10 ms |
716 KB |
Output is correct |
6 |
Correct |
79 ms |
16504 KB |
Output is correct |
7 |
Correct |
102 ms |
16504 KB |
Output is correct |
8 |
Correct |
77 ms |
16488 KB |
Output is correct |
9 |
Correct |
6643 ms |
18004 KB |
Output is correct |
10 |
Correct |
24 ms |
8448 KB |
Output is correct |
11 |
Correct |
20 ms |
8416 KB |
Output is correct |
12 |
Correct |
3492 ms |
11260 KB |
Output is correct |
13 |
Correct |
16 ms |
8448 KB |
Output is correct |
14 |
Correct |
16 ms |
8320 KB |
Output is correct |
15 |
Correct |
362 ms |
26120 KB |
Output is correct |
16 |
Execution timed out |
20030 ms |
24496 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |