Submission #28921

# Submission time Handle Problem Language Result Execution time Memory
28921 2017-07-17T19:26:23 Z Nikefor Rice Hub (IOI11_ricehub) C++
0 / 100
0 ms 5020 KB
#include "ricehub.h"
#include<algorithm>
int besthub(int R, int L, int X[], long long B)
{
    int optimalGain=0;
    int m, l, r;
    l = r = m = 0;
    long long spent = 0;
    int localGain = 0;


        while(1) {
            if(r!=(R-1))r++;
            else break;
            spent+= X[r]-X[m];
            m = (r+l+1)/2;

            if(spent>B) {
                optimalGain = std::max(optimalGain, localGain);

                while(spent>B) {
                    spent+= X[l]-X[m];
                    l++;

                    m = (r+l+1)/2;
                    localGain--;
                }


            }
            localGain++;
        }


  return optimalGain ;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 5020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 5020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 5020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 5020 KB Output isn't correct
2 Halted 0 ms 0 KB -