Submission #164829

#TimeUsernameProblemLanguageResultExecution timeMemory
164829arnold518Rice Hub (IOI11_ricehub)C++14
0 / 100
5 ms508 KiB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int R, L, *X, ans;
ll B;

int besthub(int _R, int _L, int *_X, ll _B)
{
    int i, j;
    R=_R; L=_L; X=_X; B=_B;

    ll S=0;
    for(i=0, j=0; i<R; i++)
    {
        for(; j<R && S<=B; j++) S+=X[j]-X[i+j>>1];
        ans=max(ans, j-i);
    }
    return ans;
}

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:20:44: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         for(; j<R && S<=B; j++) S+=X[j]-X[i+j>>1];
                                           ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...