제출 #1128370

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
11283702024-12-21 01:58:05lucaskojima쌀 창고 (IOI11_ricehub)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#include "ricehub.h"
#define int long long
using namespace std;
int besthub(int n, int x, int vv[], int c) {
vector<int> v(n + 1);
for (int i = 1; i <= n; i++)
v[i] = vv[i - 1];
vector<int> pref(n + 1);
for (int i = 1; i <= n; i++)
pref[i] = pref[i - 1] + v[i];
auto ok = [&](int k) -> bool {
for (int l = 1, r = k; r <= n; l++, r++) {
int m = (l + r) / 2;
int sumL = pref[m - 1] - pref[l - 1];
int sumR = pref[r] - pref[m];
int cost = abs(v[m] * (m - l) - sumL) + abs(sumR - v[m] * (r - m));
if (cost <= c)
return true;
}
return false;
};
int l = 1; // l is good
int r = n + 1; // r is bad
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

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