Submission #28918

# Submission time Handle Problem Language Result Execution time Memory
28918 2017-07-17T19:11:19 Z Nikefor Rice Hub (IOI11_ricehub) C++
0 / 100
1000 ms 5060 KB
#include "ricehub.h"
#include<algorithm>
int field[10001];
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(r<R) {
            if(r!=(R-1))r++;
            m = ((r-l)%2)?(r+l+1)/2:(r+l)/2;
            spent+= X[r]-X[m];
            if(spent>B) {
                optimalGain = std::max(optimalGain, localGain);
                while(spent>B) {
                    l++;
                    spent-= X[l]-X[m];
                    m = ((r-l)%2)?(r+l+1)/2:(r+l)/2;
                    localGain--;
                }

                continue;
            }
            localGain++;
        }


  return optimalGain ;
}
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 5060 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 5060 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 5060 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 5060 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -