Submission #307772

# Submission time Handle Problem Language Result Execution time Memory
307772 2020-09-29T09:52:23 Z amunduzbaev Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include "ricehub.h"
#include <bits/stdc++.h>
#include "grader.cpp"
using namespace std;
#define ll long long

int n,l,b,a[10005];

int fun(int x){
    vector<int>v(n);
    for(int i=0;i<n;i++){
        v[i]=(abs(a[i]-x));
    }
    sort(v.begin(),v.end());
    ll s=0;
    for(int i=0;i<n;i++){
        if(s+v[i]>b)
            return i;
        s+=v[i];
    }
    return n;
}

int besthub(int N, int L, int x[], ll B)
{
    n=N, l=L, b=B;
    int ans=0;

    for(int i=0;i<n;i++){
        a[i]=x[i];
    }

    for(int i=0;i<n;i++){
        ans=max(fun(a[i]),ans);
    }
    return ans;
}

Compilation message

/tmp/ccIHdw5K.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccHoFrnd.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status