Submission #481758

#TimeUsernameProblemLanguageResultExecution timeMemory
481758uHyHnRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //IBOW #define Task "RiceHub" #define DB(X) { cerr << #X << " = " << (X) << '\n'; } #define DB1(A, _) { cerr << #A << "[" << _ << "] = " << (A[_]) << '\n'; } #define DB2(A, _, __) { cerr << #A << "[" << _ << "][" << __ << "] = " << (A[_][__]) << '\n'; } #define DB3(A, _, __, ___) { cerr << #A << "[" << _ << "][" << __ << "][" << ___ << "] = " << (A[_][__][___]) << '\n'; } #define pb push_back #define F first #define S second #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() #define eb emplace_back using namespace std; typedef long long ll; typedef pair<int, int> ii; typedef pair<ii, int> iii; const int N = 2e5 + 10; const int inf = 2e9 + 10; const ll INF = 2e18 + 10; const int MOD = 1e9 + 7; int n, L, x[N], B, pre[N]; bool ok(int va) { int mn = inf; for (int i = va; i <= n; ++i) { int tv = (pre[i] - pre[i - va]) / va + ((pre[i] - pre[i - va]) % va > 0); int pos = upper_bound(x + i - va + 2, x + i + 1, tv) - x - 1; mn = min(mn, (tv * (pos - i + va) - pre[pos] + pre[i - va]) + (pre[i] - pre[pos] - tv * (i - pos))); } return mn <= B; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> L >> B; for (int i = 1; i <= n; ++i) cin >> x[i], pre[i] = pre[i - 1] + x[i]; int L = 1, R = 1e9, ans = -1; while (L <= R) { int mid = (L + R) / 2; if (ok(mid)) L = mid + 1, ans = mid; else R = mid - 1; } cout << ans; return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccKSyuor.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccvNsDLp.o:ricehub.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccKSyuor.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