#include "wombats.h"
#ifndef EVAl
#include "grader.cpp"
#endif
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define ff first
#define ss second
const int N = 105;
vector<pair<int, int>> edges[N];
int n, m;
int h[N][N], v[N][N];
void init(int R, int C, int H[5000][200], int V[5000][200]) {
//cout<<"start\n\n";
n = R, m = C;
for(int i=0;i<n-1;i++){
for(int j=0;j<m;j++) v[i][j] = V[i][j];
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++) h[i][j] = H[i][j];
}
for(int i=0;i<n-1;i++){
for(int j=0;j<m;j++){
edges[i * m + j].pb({(i+1) * m + j, v[i][j]});
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m-1;j++){
edges[i * m + j].pb({i * m + j + 1, h[i][j]});
edges[i * m + j + 1].pb({i * m + j, h[i][j]});
}
}
//for(int i=0;i<n*m;i++){
//for(auto x:edges[i]) cout<<i<<" "<<x.ff<<" "<<x.ss<<"\n";
//}cout<<"______\n";
}
void changeH(int p, int q, int w) {
for(auto &x:edges[p*m+q]){
if(x.ff == p*m+q+1) x.ss = w;
}
for(auto &x:edges[p*m+q+1]){
if(x.ff == p*m+q) x.ss = w;
}
//for(int i=0;i<n*m;i++){
//for(auto x:edges[i]) cout<<i<<" "<<x.ff<<" "<<x.ss<<"\n";
//}cout<<"_____________\n";
}
void changeV(int p, int q, int w) {
//cout<<"prikol\n";
//cout<<p*m+q<<" "<<(p+1)*m+q<<"\n";
for(auto &x:edges[p*m+q]){
//cout<<x.ff<<"\n";
if(x.ff == (p+1)*m+q){
x.ss = w;
}
}
//cout<<"\n\n";
}
#define ll long long
const ll mod = 1e18+7;
int escape(int V1, int V2) {
//V1--, V2--;
priority_queue<pair<int, int>> qq;
qq.push({0, V1});
vector<ll> dis(n*m, mod);
dis[V1] = 0;
//cout<<"hh\n";
//for(int i=0;i<n*m;i++){
//for(auto x:edges[i]) cout<<i<<" "<<x.ff<<" "<<x.ss<<"\n";
//}
//cout<<"\n\n";
while(!qq.empty()){
int cur = qq.top().ss, dd = qq.top().ff; qq.pop();
if(dd > dis[cur]) continue;
for(auto x:edges[cur]){
if(dis[x.ff] > dis[cur] + x.ss){
dis[x.ff] = dis[cur] + x.ss;
qq.push({-dis[x.ff], x.ff});
}
}
}
//for(int i=0;i<n;i++){
//for(int j=0;j<m;j++){
//cout<<dis[i*m+j]<<" ";
//}cout<<"\n";
//}
//cout<<"\n"<<dis[m* (n-1) + V2]<<"\n";
return dis[m * (n-1) + V2];
}
/*
3 4
0 2 5
7 1 1
0 4 0
0 0 0 2
0 3 4 7
5
3 2 1
3 3 3
2 0 0 5
1 1 1 6
3 2 1
*/
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;
| ^~~
wombats.cpp:4:10: fatal error: grader.cpp: No such file or directory
4 | #include "grader.cpp"
| ^~~~~~~~~~~~
compilation terminated.