Submission #28787

# Submission time Handle Problem Language Result Execution time Memory
28787 2017-07-17T07:46:42 Z Nikefor Rice Hub (IOI11_ricehub) C++
0 / 100
1000 ms 5060 KB
#include "ricehub.h"
int field[10001];
int besthub(int R, int L, int X[], long long B)
{
    for(int i=0; i<R; i++) field[ X[i] ]++;
    long long optimalGain = 0;
    for(int i=0; i<L; i++) {
        long long localGain =0,  constraint = 0;
        for(int j=1; j<=L and constraint+j<=B; j++) {
            if( (i-j) > 0 && field[i-j]) {constraint+=j; localGain+=field[i-j];}
            if( (i+j) <= L && field[i+j] && constraint+j<=B) {constraint+=j; localGain+=field[i+j];}
        }
        if(localGain>optimalGain) optimalGain = localGain;
    }

  return optimalGain ;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5060 KB Output is correct
2 Correct 0 ms 5060 KB Output is correct
3 Correct 0 ms 5060 KB Output is correct
4 Incorrect 0 ms 5060 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 5060 KB Output is correct
2 Incorrect 0 ms 5060 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 5060 KB Output is correct
2 Correct 13 ms 5060 KB Output is correct
3 Execution timed out 1000 ms 5060 KB Execution timed out
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 5060 KB Output isn't correct
2 Halted 0 ms 0 KB -