답안 #533617

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533617 2022-03-06T16:25:51 Z __Variatto 쌀 창고 (IOI11_ricehub) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ll long long
const int MAX=1e5+10;
int n, l, b, pref[MAX], t[MAX];
bool spr(int x){
    for(int i=1; i<=n-x+1; i++){
        int mid=(i+i+x-1)/2;
        int lewo=pref[mid-1]-pref[i-1];
        int prawo=pref[i+x-1]-pref[mid];
        if((mid-i)*t[mid]-lewo+prawo-(i+x-1-mid)*t[mid]<=b)
            return true;
    }
    return false;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    cin>>n>>l>>b;
    for(int i=1; i<=n; i++){
        cin>>pref[i];
        t[i]=pref[i];
        pref[i]+=pref[i-1];
    }
    int pocz=1, kon=n, sr, wynik=1;
    while(pocz<=kon){
        sr=(pocz+kon)/2;
        if(spr(sr))
            pocz=sr+1, wynik=sr;
        else
            kon=sr-1;
    }
    cout<<wynik<<"\n";
}

Compilation message

/usr/bin/ld: /tmp/ccWh8Sm0.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccQ0rEi1.o:ricehub.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccWh8Sm0.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