#include <bits/stdc++.h>
#include "walk.h"
#include "grader.cpp"
using namespace std;
//macros
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#define REP(a,b,c) for(int a=int(b); a<int(c); a++)
#define RE(a,c) REP(a,0,c)
#define RE1(a,c) REP(a,1,c+1)
#define REI(a,b,c) REP(a,b,c+1)
#define REV(a,b,c) for(int a=int(c-1); a>=int(b); a--)
#define INF 1e18
#define pb push_back
#define fi first
#define se second
#define sz size()
ll min_distance(vi x, vi h, vi l, vi r, vi y, int s, int g) {
int n, m;
n = x.sz; m = l.sz;
priority_queue<iii> pq;
map<int,ll> mp;
RE(i,m) pq.push({r[i],2,i});
RE(i,m) pq.push({l[i],1,i});
RE(i,m) pq.push({r[i],0,i});
vll dp(m);
ll ans = INF;
while(!pq.empty()) {
iii p = pq.top(); pq.pop();
int x, t, i;
tie(x, t, i) = p;
if(t == 2) {
if(x == n-1) {
dp[i] = y[i];
} else {
dp[i] = INF;
auto it = mp.lower_bound(y[i]);
if(it != mp.end())
dp[i] = min(dp[i], it->se + it->fi - y[i]);
it = mp.upper_bound(y[i]);
if(it != mp.begin())
--it, dp[i] = min(dp[i], it->se + y[i] - it->fi);
}
} else if(t == 1) {
if(x == 0)
ans = min(ans, dp[i]+y[i]);
mp.erase(y[i]);
} else {
mp[y[i]] = dp[i];
}
}
if(ans == INF) ans = -1;
else ans += x[n-1]-x[0];
return ans;
}
Compilation message
/tmp/cctV95Th.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccCJh7og.o:walk.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status