Submission #1123222

#TimeUsernameProblemLanguageResultExecution timeMemory
1123222nguyenhx2k7Rice Hub (IOI11_ricehub)C++20
Compilation error
0 ms0 KiB
/*

░▒▓████████▓▒░▒▓█▓▒░       ░▒▓██████▓▒░░▒▓█▓▒░░▒▓██████▓▒░       ░▒▓█▓▒░░▒▓███████▓▒░      ░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓████████▓▒░      ░▒▓███████▓▒░░▒▓████████▓▒░░▒▓███████▓▒░▒▓████████▓▒░
░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░                ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░             ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░         ░▒▓█▓▒░
░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░      ░▒▓█▓▒░▒▓█▓▒░                ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░             ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░      ░▒▓█▓▒░         ░▒▓█▓▒░
░▒▓██████▓▒░ ░▒▓█▓▒░      ░▒▓████████▓▒░▒▓█▓▒░▒▓████████▓▒░      ░▒▓█▓▒░░▒▓██████▓▒░          ░▒▓█▓▒░   ░▒▓████████▓▒░▒▓██████▓▒░        ░▒▓███████▓▒░░▒▓██████▓▒░  ░▒▓██████▓▒░   ░▒▓█▓▒░
░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░         ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░             ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░             ░▒▓█▓▒░  ░▒▓█▓▒░
░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░      ░▒▓█▓▒░      ░▒▓█▓▒░         ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░             ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░             ░▒▓█▓▒░  ░▒▓█▓▒░
░▒▓████████▓▒░▒▓████████▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░      ░▒▓█▓▒░▒▓███████▓▒░          ░▒▓█▓▒░   ░▒▓█▓▒░░▒▓█▓▒░▒▓████████▓▒░      ░▒▓███████▓▒░░▒▓████████▓▒░▒▓███████▓▒░   ░▒▓█▓▒░



*/
#include <bits/stdc++.h>
#define nelaia ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define ll long long
#define pll pair<ll, ll>
#define pii pair<int, int>
#define ff first
#define ss second
#define vi vector<int>
#define vll vector<ll>
#define vp vector<pll>
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend();
#define name "fields."
#define initiation freopen(name"inp", "r", stdin);freopen(name"out", "w", stdout);
#define BIT(x, i) (((x) >> (i)) & 1)
#define MASK(i) (1 << (i))

using namespace std;
const ll maxn = 1e5 + 5;
const ll INF = 1e9 + 7;
const ll LINF = 1e18;
const ll mod = 1e9 + 7;

ll calc(ll R, ll L, ll a[], ll B){
    vll pos(R + 5, 0);
    for(ll i = 1; i <= R; i++){
        pos[i + 1] = pos[i] + a[i];
    }

    ll r = 0, ans = 1;
    for(ll l = 0; l <= R; l++){
        while(r < R){
            ll m = (l + r) / 2;
            ll tmp = 0;
            if((l + r + 1) % 2 != 0){
                tmp -= a[m];
            }
            tmp -= pos[m] - pos[l];
            tmp += pos[r + 1] - pos[m];
            if(tmp > B){
                break;
            }
            r++;
        }

        ans = max(ans, r - l);
        if(r == R){
            break;
        }
    }
    return ans;
}

ll a[maxn];
void process(){
    ll r, l, b;
    cin >> r >> l >> b;
    for(ll i = 1; i <= r; i++) cin >> a[i];
    cout << calc(r, l, a, b);
}

int main()
{
    nelaia
//    initiation
    ll sub;
    cin >> sub;
    ll time;
    time = 1;
//    cin >> time;
    while(time--){
        process();

    }
    return 0;
}

Compilation message (stderr)

/usr/bin/ld: /tmp/cc0V3mNP.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccjLxOU9.o:ricehub.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc0V3mNP.o: in function `main':
grader.cpp:(.text.startup+0xaa): undefined reference to `besthub(int, int, int*, long long)'
collect2: error: ld returned 1 exit status