답안 #1015120

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1015120 2024-07-06T06:21:45 Z KasymK 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include "bits/stdc++.h"
#include "ricehub.h"
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(v) v.begin(), v.end()

int best_hub(int r, int l, int x[], ll b){
    int answer = 0;
    deque<int> diff;
    for(int cor = 1; cor <= l; ++cor){
        diff.clear();
        int sm = 0;
        for(int i = 0; i < r; ++i)
            diff.push_back(abs(cor-x[i]));
        sort(all(diff));
        while(1){
            if(b-diff[0] >= 0)
                b -= diff[0], diff.pop_front(), sm++;
            else
                break;
        }
        answer = max(answer, sm);
    }
    return answer;
}

Compilation message

/usr/bin/ld: /tmp/ccXz8TKO.o: in function `main':
grader.cpp:(.text.startup+0xae): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status