Submission #972536

#TimeUsernameProblemLanguageResultExecution timeMemory
972536akacool445kRainforest Jumps (APIO21_jumps)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> // #include "jumps.h" using namespace std; // #define int long long #define ll long long #define ff first #define ss second #define pint pair < int , int > #define fast ios_base::sync_with_stdio(NULL); cin.tie(NULL) typedef vector < int > vint; const int inf = 1e9 + 9; const int mxn = 2e5 + 2; const int mod = 1e9 + 7; int n; int h[mxn] , le[mxn] , ri[mxn]; int inv[mxn]; int spx[19][mxn] , spn[19][mxn]; int s[3 * mxn]; void build(int id, int L, int R) { if(L == R) { s[id] = h[L]; return; } int x = 2 * id + 1, y = x + 1, M = (L + R) / 2; build(x, L, M); build(y, M + 1, R); s[id] = max(s[x], s[y]); } pair<int, int> query(int id, int L, int R, int l, int r, int d) { if(L == R) { if(s[id] > d) return {-1, 0}; return {s[id], 1}; } int x = 2 * id + 1, y = x + 1, M = (L + R) / 2; if(L == l && R == r) { if(s[id] < d) return {s[id], 1}; pint pr = query(x, L, M, l, r, d); if(pr.ss == 0) return pr; pint pl = query(y, M + 1, R, l, r, d); return {max(pl.ff, pr.ff), 0}; } if(r <= M) return query(x, L, M, l, r, d); if(M + 1 <= l) return query(y, M + 1, R, l, r, d); pint pr = query(x, M + 1, R, l, r, d); if(pr.ss == 0) return pr; pint pl = query(y, L, M, l, r, d); return {max(pl.ff, pr.ff), pl.ss}; } int main() { int t, n; cin >> t >> n; for(int i = 0; i < n; i++) cin >> h[i]; build(0, 0, n - 1); while(t--) { int r, l, p; cin >> l >> r >> p; cout << query(0, 0, n - 1, l, r, p).ff << '\n'; } }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc2sPI1c.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc9aBjia.o:jumps.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc2sPI1c.o: in function `main':
stub.cpp:(.text.startup+0x177): undefined reference to `init(int, std::vector<int, std::allocator<int> >)'
/usr/bin/ld: stub.cpp:(.text.startup+0x1d1): undefined reference to `minimum_jumps(int, int, int, int)'
collect2: error: ld returned 1 exit status