# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1110228 | dung3683833 | Rice Hub (IOI11_ricehub) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 +5 ;
int a[N];
signed main() {
int n, l, k;
cin >> n >> l >> k;
for (int i = 1; i <= n; i++) cin >> a[i];
// sort(a+1, a+n+1);
int ma = 0;
for (int i = 1; i <= n; i++) {
int pos = upper_bound(a+i+1, a+n+1, a[i] + k) - a - 1;
ma = max(ma, pos - i + 1);
}
cout << ma;
return 0;
}