제출 #1138148

#제출 시각아이디문제언어결과실행 시간메모리
1138148MattNattFeczan쌀 창고 (IOI11_ricehub)C++20
컴파일 에러
0 ms0 KiB
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; int besthub(int R, int L, vector<int>& X, long long B) { int max_fields = 0; // Iterate over all possible hub positions (1 to L) for (int hub = 1; hub <= L; ++hub) { // Calculate the cost of transporting rice for each subset of rice fields for (int start = 0; start < R; ++start) { long long cost = 0; int count = 0; for (int end = start; end < R; ++end) { cost += abs(X[end] - hub); if (cost > B) { break; } count++; max_fields = max(max_fields, count); } } } return max_fields; }

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

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