#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(20) << (x)
#define all(v) (v).begin(), (v).end()
using namespace std;
#define forn(i,n) for (int i = 0; i < (n); ++i)
#define rforn(i, n) for(int i = (n) - 1;i >= 0;--i)
#define sz(x) (int)x.size()
#define ff first
#define se second
#define mp make_pair
using ll = long long;
int mod = (ll)1e9 + 7;
const int INF = 1e9 + 1;
const double eps = 1e-7;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
template<class T, size_t SZ> using AR = array<T, SZ>;
template<class T> using PR = pair<T, T>;
template <typename XPAX>
bool ckma(XPAX &x, XPAX y) {
return (x < y ? x = y, 1 : 0);
}
template <typename XPAX>
bool ckmi(XPAX &x, XPAX y) {
return (x > y ? x = y, 1 : 0);
}
V<int> g[200001];
int dis[200001];
void init(int N, int H[]) {
stack<int> st;
forn(i, N) {
while(sz(st) && H[st.top()] < H[i])
st.pop();
g[i].push_back(st.top());
st.push(i);
}
while(sz(st))st.pop();
rforn(i, N) {
while(sz(st) && H[st.top()] < H[i])
st.pop();
g[i].push_back(st.top());
st.push(i);
}
forn(i, N) {
dis[i] = -1;
}
}
int minimum_jumps(int A, int B, int C, int D) {
queue<int> q;
V<int> clr;
for(int a = A;a <= B;++a) {
q.push(a);
dis[a] = 0;
}
while(sz(q)) {
int v = q.front();
q.pop();
if(C <= v && v <= D)
return dis[v];
for(auto c : g[v]) {
if(dis[c] == -1) {
dis[c] = dis[v]+1;
q.push(c);
}
}
}
return -1;
}
Compilation message
/usr/bin/ld: /tmp/ccQQ9wCT.o: in function `main':
stub.cpp:(.text.startup+0x177): undefined reference to `init(int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status