답안 #500811

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
500811 2022-01-01T10:21:07 Z beaconmc 쌀 창고 (IOI11_ricehub) C++14
컴파일 오류
0 ms 0 KB
//#include "ricehub.h"
#include <bits/stdc++.h>


typedef long long ll;
#define FOR(i, x, y) for(ll i=x; i<y; i++)

using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
  
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>


int besthub(int R, int L, int X[], ll B){
    ll lo = 0, hi = 0;
    ll ans = 1;
    ll curcost  = 0;
    while (hi<R-1){
        if (hi==lo) curcost += 0;
        else if ((hi-lo)%2==0) curcost += X[hi] - X[(hi-lo-1)/2+1 + lo];
        else curcost += X[hi] - X[(hi-lo-1)/2 + lo];
        if (curcost>B){
            if ((hi-lo)%2==0) curcost -= X[hi], curcost += X[lo];
            else curcost -= X[hi], curcost+= X[lo];
            lo ++;
        } else hi++;
        
        
        ans = max(ans, hi-lo);
    }
    return ans;
}


int main(){
    int R,L,B;
    cin >> R >> L >> B;
    int X[R];
    FOR(i, 0, R){
        cin >> X[i];
    }
    cout << besthub(R, L, X, B);
}

Compilation message

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