답안 #782718

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
782718 2023-07-14T08:21:18 Z JoenPoenMan 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include "grader.cpp"
#include "ricehub.h"
#include <bits/stdc++.h>

using namespace std;

#define ALL(arr) begin(arr), end(arr)
#define CONTAINS(arr, val) (find(ALL(arr), val) == end(arr))

typedef pair<int, int> ii;

int besthub(int R, int L, int X[], long long B)
{
    vector<int> crs;
    long long cost = 0;
    int i = 0;
    int best = 0;
    int dc = 0;
    for (int x = 1; x <= L && i < R; x++)
    {
        while (crs.size() && i < R && (X[i]-x) <= crs[0]) {
            cost -= crs[0];
            crs.erase(crs.begin());
            crs.push_back(x - X[i]);
            cost += X[i]-x;
            dc -= 2;
            i++;
        }
        while (i < R && cost + (X[i]-x) <= B) {
            crs.push_back(x - X[i]);
            cost += X[i]-x;
            dc--;
            i++;
        }
        best = max(best, (int)crs.size());
        for (int &el : crs) {
            if (el == 0) {
                dc += 2;
            } 
            el++;
        }
        cost += dc;
        while (cost > B) {
            cost -= crs[0];
            crs.erase(crs.begin());
            dc--;
        }
    }
    return best;
}

Compilation message

/usr/bin/ld: /tmp/ccT7dziN.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccYJnBCN.o:ricehub.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status