# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113203 | 2019-05-24T10:13:50 Z | ecksdee | Rice Hub (IOI11_ricehub) | C++11 | 0 ms | 0 KB |
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; int besthub(int R, int L, int X[], int B) { int maxim[R]; memset(maxim, 1, sizeof(maxim)); for (int i = 0; i < R; i++) { for (int x = i; x < R; x++) { if ((maxim[i] + (X[x] - X[i])) < B) { maxim[i] ++; } } } sort(maxim, maxim+R, greater<int>()); return maxim[0]; } int main() { int R, L, B; int X[5]; cin >> R >> L >> B; for (int i = 0; i < R; i++) { cin >> X[i]; } cout << besthub(R, L, X, B); }