Submission #904984

#TimeUsernameProblemLanguageResultExecution timeMemory
904984MackerRice Hub (IOI11_ricehub)C++17
Compilation error
0 ms0 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define all(v) v.begin(), v.end() //#pragma GCC optimize("Ofast") //#pragma GCC target("avx2") vector<ll> v; ll b, n; bool can(ll k){ ll med = v[k / 2]; ll dst = 0; for (ll i = 0; i < k / 2; i++) { dst += med - v[i]; } for (ll i = k / 2; i < k; i++) { dst += v[i] - med; } if(dst <= b) return true; ll lmed = med; for (ll i = k; i < n; i++) { med = v[(i + i - k + 1) / 2]; dst -= med - v[i - k]; dst += v[i] - lmed; if(dst <= b) return true; lmed = med; } return false; } int besthub(ll R, ll L, ll X[], long long B) { v.assign(X, X+R); b = B; n = R; ll l = 0, r = R, mid; while(l < r){ mid = (l + r + 1) / 2; if(can(mid)) l = mid; else r = mid - 1; } return l; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccX4Y0Vu.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status