Submission #224612

# Submission time Handle Problem Language Result Execution time Memory
224612 2020-04-18T13:51:39 Z AASG Rice Hub (IOI11_ricehub) C++11
Compilation error
0 ms 0 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B){
    long adr[L+10];
    memset(adr,0,sizeof(adr));
    for(long i=0;i<R;i++)adr[X[i]]=1;
    long mx=0;
  for(long i=1;i<=L;i++){
        long au=0;
        long long ab=B;
    for(long l=i;l<=L;l++){
        if(adr[l]>0 && B-abs(i-l)>=0){au++;B=B-abs(i-l);}
    }
    for(long l=i-1;l>0;l--){
        if(adr[l]>0 && b-abs(i-l)>=0){au++;B=B-abs(i-l);}
    }
    mx=max(mx,au);
  }
  R=mx;
  return R;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:16:24: error: 'b' was not declared in this scope
         if(adr[l]>0 && b-abs(i-l)>=0){au++;B=B-abs(i-l);}
                        ^
ricehub.cpp:11:19: warning: unused variable 'ab' [-Wunused-variable]
         long long ab=B;
                   ^~