Submission #1193066

#TimeUsernameProblemLanguageResultExecution timeMemory
1193066NomioRice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int besthub(int R, int L, vector<int> X, int B) {
	int ans = 0;
	for(int i = 0; i < R; i++) {
		vector<int> v;
		for(int j = 0; j < R; j++) {
			v.push_back(abs(X[i] - X[j]));
		}
		sort(v.begin(), v.end());
		int cnt = 0, s = 0, j = -1;
		while(s + v[j + 1] <= B) {
			j++;
			s += v[j];
			cnt++;
		}
		ans = max(cnt, ans);
	}
	return ans;
}
//
//int main() {
//	cout << besthub(5, 20, {1, 2, 10, 12, 14}, 6) << '\n';
//}

Compilation message (stderr)

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