#include "wombats.h"
#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[5001][201];
int b[5001][201];
int calc[5001][201];
void init(int R,int C,int H[5000][200],int V[5000][200]){
n = R , m = C;
for(int i = 0;i<n;i++){
for(int j = 0;j<m-1;j++){
a[i][j] = H[i][j];
}
}
for(int i = 0;i<n-1;i++){
for(int j = 0;j<m;j++){
b[i][j] = V[i][j];
}
}
}
void changeH(int P,int Q,int W){
a[P][Q] = W;
}
void changeV(int P,int Q,int W){
b[P][Q] = W;
}
int escape(int V1,int V2){
for(int i = 0;i<n;i++){
for(int j = 0;j<m;j++){
calc[i][j] = 1e9;
}
}
calc[0][V1] = 0;
for(int i = 0;i<n;i++){
if(i){
for(int j = 0;j<m;j++){
calc[i][j] = calc[i-1][j]+b[i-1][j];
}
}
vector<int> lol1(m,0);
int mi = 1e9;
for(int j = 0;j<m;j++){
if(j){
mi+=a[i][j-1];
}
mi = min(mi,calc[i][j]);
lol1[j] = mi;
}
mi = 1e9;
for(int j = m-1;j>=0;j--){
if(j<m-1){
mi+=a[i][j];
}
mi = min(mi,calc[i][j]);
calc[i][j] = min(lol1[j],mi);
}
}
return calc[n-1][V2];
}/*
int main(){
}
*/
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 |
58 ms |
12096 KB |
Output is correct |
2 |
Correct |
51 ms |
12100 KB |
Output is correct |
3 |
Correct |
17064 ms |
13868 KB |
Output is correct |
4 |
Correct |
54 ms |
12116 KB |
Output is correct |
5 |
Correct |
47 ms |
12100 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
312 KB |
Output is correct |
6 |
Correct |
2 ms |
312 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
312 KB |
Output is correct |
9 |
Correct |
2 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
308 KB |
Output is correct |
11 |
Correct |
393 ms |
1728 KB |
Output is correct |
12 |
Correct |
1 ms |
312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
724 KB |
Output is correct |
2 |
Correct |
6 ms |
688 KB |
Output is correct |
3 |
Correct |
6 ms |
704 KB |
Output is correct |
4 |
Correct |
6 ms |
724 KB |
Output is correct |
5 |
Correct |
6 ms |
708 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
6 ms |
800 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
117 ms |
19984 KB |
Output is correct |
2 |
Correct |
107 ms |
19976 KB |
Output is correct |
3 |
Correct |
106 ms |
20000 KB |
Output is correct |
4 |
Correct |
10144 ms |
21068 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
724 KB |
Output is correct |
2 |
Correct |
6 ms |
704 KB |
Output is correct |
3 |
Correct |
6 ms |
812 KB |
Output is correct |
4 |
Correct |
6 ms |
724 KB |
Output is correct |
5 |
Correct |
6 ms |
724 KB |
Output is correct |
6 |
Correct |
109 ms |
19988 KB |
Output is correct |
7 |
Correct |
108 ms |
19964 KB |
Output is correct |
8 |
Correct |
108 ms |
19908 KB |
Output is correct |
9 |
Correct |
10483 ms |
20964 KB |
Output is correct |
10 |
Correct |
47 ms |
11988 KB |
Output is correct |
11 |
Correct |
61 ms |
12104 KB |
Output is correct |
12 |
Correct |
17269 ms |
14124 KB |
Output is correct |
13 |
Correct |
46 ms |
12116 KB |
Output is correct |
14 |
Correct |
47 ms |
12116 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
1 ms |
212 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
2 ms |
312 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
420 KB |
Output is correct |
21 |
Correct |
1 ms |
340 KB |
Output is correct |
22 |
Correct |
1 ms |
312 KB |
Output is correct |
23 |
Correct |
1 ms |
340 KB |
Output is correct |
24 |
Correct |
1 ms |
340 KB |
Output is correct |
25 |
Correct |
385 ms |
1668 KB |
Output is correct |
26 |
Correct |
2 ms |
340 KB |
Output is correct |
27 |
Correct |
6 ms |
724 KB |
Output is correct |
28 |
Execution timed out |
20048 ms |
20200 KB |
Time limit exceeded |
29 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
724 KB |
Output is correct |
2 |
Correct |
7 ms |
796 KB |
Output is correct |
3 |
Correct |
7 ms |
800 KB |
Output is correct |
4 |
Correct |
8 ms |
724 KB |
Output is correct |
5 |
Correct |
6 ms |
700 KB |
Output is correct |
6 |
Correct |
109 ms |
19996 KB |
Output is correct |
7 |
Correct |
123 ms |
19964 KB |
Output is correct |
8 |
Correct |
124 ms |
19988 KB |
Output is correct |
9 |
Correct |
11239 ms |
21000 KB |
Output is correct |
10 |
Correct |
49 ms |
12116 KB |
Output is correct |
11 |
Correct |
52 ms |
12236 KB |
Output is correct |
12 |
Correct |
17645 ms |
14124 KB |
Output is correct |
13 |
Correct |
48 ms |
12116 KB |
Output is correct |
14 |
Correct |
49 ms |
12112 KB |
Output is correct |
15 |
Correct |
173 ms |
20224 KB |
Output is correct |
16 |
Execution timed out |
20037 ms |
20328 KB |
Time limit exceeded |
17 |
Halted |
0 ms |
0 KB |
- |