Submission #28784

# Submission time Handle Problem Language Result Execution time Memory
28784 2017-07-17T07:44:41 Z Nikefor Rice Hub (IOI11_ricehub) C++
Compilation error
0 ms 0 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 = 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:8:31: error: 'constraint' was not declared in this scope
         long long localGain = constraint = 0;
                               ^