Submission #234266

# Submission time Handle Problem Language Result Execution time Memory
234266 2020-05-23T15:36:48 Z pere_gil Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include "ricehub.h"
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

ll absolute(int a, int b){
    int res=a-b;
    if(res<0) res*=-1;
    return res;
}

int besthub(int R, int L, int X[], ll B)
{
    ll big=0;
    for(int i=1;i<=L;i++){
        ll transported=0;
        ll a=0;
        std::vector<ll> dist;
        for(int j=0;j<R;j++) dist.push_back(absolute(i-X[j]));
        sort(dist.begin(), dist.end());
        for(int j=0;j<R;j++){
            if(transported+dist[j]<=B){ transported+=dist[j]; a++; }
            else break;
        }
        big=max(big, a);
    }

    return big;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:20:60: error: too few arguments to function 'll absolute(int, int)'
         for(int j=0;j<R;j++) dist.push_back(absolute(i-X[j]));
                                                            ^
ricehub.cpp:7:4: note: declared here
 ll absolute(int a, int b){
    ^~~~~~~~