Submission #261575

# Submission time Handle Problem Language Result Execution time Memory
261575 2020-08-11T21:43:15 Z c4ts0up Rice Hub (IOI11_ricehub) C++17
Compilation error
0 ms 0 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

vector <ll> arr;

ll RO(ll budget, ll cord) {
	priority_queue <ll, vector <ll>, greater <ll> > pq;
	
	for (ll x : arr) pq.push(abs(x-cord));
	
	ll paks = 0, suma = 0;
	
	while (!pq.empty() && suma <= budget) {
		ll curr = pq.top();
		pq.pop();
		
		if (suma + curr <= budget) suma += curr, paks++;
		else break;
	}
	
	return paks;
}

ll besthub(int R, int L, int X[], ll B) {
	for (ll i=0; i<R; i++) arr.push_back((ll)X[i]);
	
	ll maxi = 0;
	for (ll i=1; i<=L; i++) {
		maxi = max(maxi, RO(B, i));
	}
	return maxi;
}

Compilation message

ricehub.cpp: In function 'll besthub(int, int, int*, ll)':
ricehub.cpp:26:4: error: ambiguating new declaration of 'll besthub(int, int, int*, ll)'
 ll besthub(int R, int L, int X[], ll B) {
    ^~~~~~~
In file included from ricehub.cpp:1:0:
ricehub.h:1:5: note: old declaration 'int besthub(int, int, int*, long long int)'
 int besthub(int R, int L, int X[], long long B);
     ^~~~~~~