#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
int dist[100][5000][100];
int R, C, H[5000][200], V[5000][200];
bool sussy;
void solve(){
for (int tt=0; tt<C; ++tt){
memset(dist[tt], 0x3f, sizeof dist[tt]);
dist[tt][0][tt]=0;
for (int i=0; i<R; ++i){
for (int j=1, mn=dist[tt][i][0]; j<C; ++j){
mn=min(mn+H[i][j-1], dist[tt][i][j]);
dist[tt][i][j]=min(dist[tt][i][j], mn);
}
for (int j=C-2, mn=dist[tt][i][C-1]; j>=0; --j){
mn=min(mn+H[i][j], dist[tt][i][j]);
dist[tt][i][j]=min(dist[tt][i][j], mn);
}
if (i+1<R){
for (int j=0; j<C; ++j) dist[tt][i+1][j]=dist[tt][i][j]+V[i][j];
}
}
}
}
void init(int _R, int _C, int _H[5000][200], int _V[5000][200]) {
R=_R, C=_C;
memcpy(H, _H, sizeof H);
memcpy(V, _V, sizeof V);
sussy=1;
}
void changeH(int P, int Q, int W) {
sussy=1;
H[P][Q]=W;
}
void changeV(int P, int Q, int W) {
sussy=1;
V[P][Q]=W;
}
int escape(int V1, int V2) {
if (sussy) solve();
return dist[V1][R-1][V2];
}
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 |
32 ms |
14168 KB |
Output is correct |
2 |
Correct |
33 ms |
14168 KB |
Output is correct |
3 |
Correct |
9904 ms |
16908 KB |
Output is correct |
4 |
Correct |
31 ms |
14168 KB |
Output is correct |
5 |
Correct |
36 ms |
14168 KB |
Output is correct |
6 |
Correct |
5 ms |
10076 KB |
Output is correct |
7 |
Correct |
5 ms |
10088 KB |
Output is correct |
8 |
Correct |
4 ms |
10332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
10076 KB |
Output is correct |
2 |
Correct |
5 ms |
10076 KB |
Output is correct |
3 |
Correct |
6 ms |
10076 KB |
Output is correct |
4 |
Correct |
728 ms |
47448 KB |
Output is correct |
5 |
Correct |
727 ms |
47468 KB |
Output is correct |
6 |
Correct |
707 ms |
47700 KB |
Output is correct |
7 |
Correct |
708 ms |
47448 KB |
Output is correct |
8 |
Correct |
554 ms |
45648 KB |
Output is correct |
9 |
Correct |
681 ms |
47452 KB |
Output is correct |
10 |
Correct |
579 ms |
45404 KB |
Output is correct |
11 |
Execution timed out |
20092 ms |
47576 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1753 ms |
204116 KB |
Output is correct |
2 |
Correct |
1463 ms |
202036 KB |
Output is correct |
3 |
Correct |
1814 ms |
204196 KB |
Output is correct |
4 |
Correct |
1870 ms |
204196 KB |
Output is correct |
5 |
Correct |
1795 ms |
202244 KB |
Output is correct |
6 |
Correct |
5 ms |
10160 KB |
Output is correct |
7 |
Correct |
4 ms |
10076 KB |
Output is correct |
8 |
Correct |
4 ms |
10076 KB |
Output is correct |
9 |
Correct |
1556 ms |
204192 KB |
Output is correct |
10 |
Correct |
7 ms |
15964 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
153 ms |
20060 KB |
Output is correct |
2 |
Correct |
173 ms |
20060 KB |
Output is correct |
3 |
Correct |
162 ms |
20072 KB |
Output is correct |
4 |
Correct |
14790 ms |
21360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1795 ms |
204116 KB |
Output is correct |
2 |
Correct |
1494 ms |
202204 KB |
Output is correct |
3 |
Correct |
1792 ms |
204112 KB |
Output is correct |
4 |
Correct |
1707 ms |
204116 KB |
Output is correct |
5 |
Correct |
1703 ms |
202212 KB |
Output is correct |
6 |
Correct |
157 ms |
20060 KB |
Output is correct |
7 |
Correct |
171 ms |
20060 KB |
Output is correct |
8 |
Correct |
147 ms |
20060 KB |
Output is correct |
9 |
Correct |
13905 ms |
21268 KB |
Output is correct |
10 |
Correct |
37 ms |
13964 KB |
Output is correct |
11 |
Correct |
31 ms |
14184 KB |
Output is correct |
12 |
Correct |
10026 ms |
16704 KB |
Output is correct |
13 |
Correct |
33 ms |
14168 KB |
Output is correct |
14 |
Correct |
33 ms |
14172 KB |
Output is correct |
15 |
Correct |
4 ms |
10076 KB |
Output is correct |
16 |
Correct |
5 ms |
10076 KB |
Output is correct |
17 |
Correct |
4 ms |
10076 KB |
Output is correct |
18 |
Correct |
734 ms |
47452 KB |
Output is correct |
19 |
Correct |
730 ms |
47452 KB |
Output is correct |
20 |
Correct |
716 ms |
47452 KB |
Output is correct |
21 |
Correct |
722 ms |
47452 KB |
Output is correct |
22 |
Correct |
612 ms |
45488 KB |
Output is correct |
23 |
Correct |
753 ms |
47452 KB |
Output is correct |
24 |
Correct |
587 ms |
45404 KB |
Output is correct |
25 |
Execution timed out |
20034 ms |
47736 KB |
Time limit exceeded |
26 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1854 ms |
204116 KB |
Output is correct |
2 |
Correct |
1568 ms |
202052 KB |
Output is correct |
3 |
Correct |
1716 ms |
204112 KB |
Output is correct |
4 |
Correct |
1934 ms |
204076 KB |
Output is correct |
5 |
Correct |
1894 ms |
202244 KB |
Output is correct |
6 |
Correct |
154 ms |
20060 KB |
Output is correct |
7 |
Correct |
160 ms |
20056 KB |
Output is correct |
8 |
Correct |
152 ms |
20064 KB |
Output is correct |
9 |
Correct |
15175 ms |
21288 KB |
Output is correct |
10 |
Correct |
31 ms |
14172 KB |
Output is correct |
11 |
Correct |
32 ms |
14168 KB |
Output is correct |
12 |
Correct |
10614 ms |
16772 KB |
Output is correct |
13 |
Correct |
28 ms |
14172 KB |
Output is correct |
14 |
Correct |
29 ms |
14172 KB |
Output is correct |
15 |
Runtime error |
2527 ms |
262144 KB |
Execution killed with signal 9 |
16 |
Halted |
0 ms |
0 KB |
- |