Submission #743306

# Submission time Handle Problem Language Result Execution time Memory
743306 2023-05-17T09:44:05 Z vjudge1 Rice Hub (IOI11_ricehub) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#include "ricehub.h"
using namespace std;
long long besthub(int R, int L, int X[], long long B)
{
    long long mx = -1;
    for(int i=1;i<=L;++i)
    {
        priority_queue<long long,vector<long long>,greater<long long>> pq;
        for(int j=0;j<R;++j)
        {
            long long dist = abs(i-X[j]);
            pq.push(dist);
        }
        long long cost = 0,rice = 0;
        while(!pq.empty())
        {
//            cout << "+" << pq.top() << '\n';
            if(cost+pq.top() <= B)
            {
                cost += pq.top();
                ++rice;
            }
            else break;
            pq.pop();
        }
        mx = max(mx,rice);
    }
    return mx;
}

Compilation message

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