Submission #411179

#TimeUsernameProblemLanguageResultExecution timeMemory
411179LouayFarahRice Hub (IOI11_ricehub)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; int S(int X[], int h, int l, int r) { int sum = 0; for(int i = l; i<=r; i++) sum = sum + abs(h-X[l]); return sum; } int besthub(int R, int L, int X[], long long B) { //int l = 0, r = R-1; int res = 0; for(int k = 0; k<R; k++) { int l = 0; int r = k; while(r<R) { int mid = (l+r)/2; int h = X[mid]; int curr = S(X, h, l, r); if(curr<=B) res = max(res, k) l++, r++; } } return res; }

Compilation message (stderr)

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:27:34: error: expected ';' before 'l'
   27 |                 res = max(res, k)
      |                                  ^
      |                                  ;
   28 |             l++, r++;
      |             ~