Submission #28786

# Submission time Handle Problem Language Result Execution time Memory
28786 2017-07-17T07:45:40 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, 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 ;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:9:23: warning: left operand of comma operator has no effect [-Wunused-value]
         for(int j=1; j<=L, constraint+j<=B; j++) {
                       ^
# 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 56 ms 5060 KB Output isn't correct
2 Halted 0 ms 0 KB -