Submission #1188768

#TimeUsernameProblemLanguageResultExecution timeMemory
1188768GoBananas69Race (IOI11_race)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include <array> using namespace std; typedef long long ll; vector<vector<pair<ll, ll>>> adj; bool check(vector<ll> &pref, ll m, ll k) { for (int i = 0; i<pref.size() - m; ++i) { if (pref[i + m] - pref[i] == k) { return true; } } return false; } ll best_path(ll n, ll k, vector<array<int, 2>> h, vector<ll> s) { adj.clear(); adj.resize(n); for (int i = 0; i < n - 1; ++i) { ll u = h[i][0], v = h[i][1], w = s[i]; adj[u].push_back({v, w}); } ll l = 0, r = n; vector<ll> pref(n, 0); for (int i = 1; i<n; ++i) { pref[i] = pref[i - 1] + s[i - 1]; } while (l + 1 < r) { ll m = (l + r) / 2; if (check(pref, m, k)) { r = m; } else { l = m; } } return (r == n ? -1 : r); }

Compilation message (stderr)

/usr/bin/ld: /tmp/cc6QXilu.o: in function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `best_path(int, int, int (*) [2], int*)'
collect2: error: ld returned 1 exit status