Submission #971440

#TimeUsernameProblemLanguageResultExecution timeMemory
971440PanndaRainforest Jumps (APIO21_jumps)C++17
Compilation error
0 ms0 KiB
#include "jumps.h" #include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 12345; vector<vector<int>> dist; void brute_init(int n, vector<int> h) { dist = vector<vector<int>>(n, vector<int>(n, INF)); for (int i = 0; i < n; i++) { dist[i][i] = 0; } for (int i = 0; i < n; i++) { for (int j = i - 1; j >= 0; j--) { if (h[j] > h[i]) { dist[i][j] = 1; break; } } for (int j = i + 1; j < n; j++) { if (h[j] > h[i]) { dist[i][j] = 1; break; } } } for (int m = 0; m < n; m++) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { dist[i][j] = min(dist[i][j], dist[i][m] + dist[m][j]); } } } } int brute_minimum_jumps(int l0, int r0, int l1, int r1) { r0++; r1++; int res = INF; for (int i = l0; i < r0; i++) { for (int j = l1; j < r1; j++) { res = min(res, dist[i][j]); } } if (res == INF) return -1; return res; }

Compilation message (stderr)

/usr/bin/ld: /tmp/cciMJgXR.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