//#include "dreaming.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;
| ^~~
/usr/bin/ld: /tmp/ccAP851W.o: in function `main':
grader.c:(.text.startup+0x129): undefined reference to `init'
/usr/bin/ld: grader.c:(.text.startup+0x194): undefined reference to `escape'
/usr/bin/ld: grader.c:(.text.startup+0x203): undefined reference to `changeH'
/usr/bin/ld: grader.c:(.text.startup+0x26d): undefined reference to `changeV'
collect2: error: ld returned 1 exit status