Submission #536443

# Submission time Handle Problem Language Result Execution time Memory
536443 2022-03-13T10:39:12 Z fdnfksd Rice Hub (IOI11_ricehub) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
#define TASKNAME "codeforce"
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pair1 vector<pair<int,int>>
#define pop1 pop_back
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
using ll=long long;
const ll maxN=2e5;
const ll maxM=1e5;
const ll INF=-1e10;
const ll mod=123456789;
ll r[maxM],T[maxN]={0},res=0,K,L,n;
bool check(ll s, ll t)
{
    ll p=(s+t)/2;
    return (p - s)*r[p] - (T[p] - T[s]) + (T[t + 1] - T[p + 1]) - (t - p)*r[p]<=K;
}
void Input()
{
    cin >> n >> L >> K;
    for(int i=0;i<n;i++) cin >> r[i];
    T[0]=0;
    for(int i=1;i<=n;i++) T[i]=T[i-1]+r[i-1];
    for(int i=0;i<n;i++)
    {
        ll l=i,r=n-1;
        while(l<=r)
        {
            ll mid=(l+r)/2;
            if(check(i,mid)) l=mid+1;
            else r=mid-1;
        }
        res=max(res,r-i+1);
    }
    cout << res <<'\n';
}
void Init()
{

}
void Solve()
{

}
void Print()
{

}
int main()
{
    fastio
    //freopen(TASKNAME".INP","r",stdin);
    //freopen(TASKNAME".OUT","w",stdout);
    Input();
    Init();
    Solve();
    Print();
}

Compilation message

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