Submission #218755

# Submission time Handle Problem Language Result Execution time Memory
218755 2020-04-02T17:13:50 Z Andrei_Cotor Rice Hub (IOI11_ricehub) C++11
0 / 100
9 ms 640 KB
#include<iostream>
#include<algorithm>
#include"ricehub.h"

using namespace std;

int Sum[100005];

long long getCost(int st, int dr, int X[])
{
    int poz=(st+dr)/2;

    long long rez=-1LL*Sum[poz]+Sum[dr]-Sum[poz];;
    if(st>0)
        rez+=Sum[st-1];
    if((dr-st+1)%2==1)
        rez+=poz;
    return rez;
}

int besthub(int N, int L, int X[], long long B)
{
    Sum[0]=X[0];
    for(int i=1; i<=N; i++)
        Sum[i]=Sum[i-1]+X[i];

    int st=0;
    int rez=0;
    for(int i=0; i<N; i++)
    {
        if(getCost(st,i,X)>B)
            st++;
        rez=max(rez,i-st+1);
    }
    return rez;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Incorrect 5 ms 384 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -