# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1110228 | 2024-11-09T02:51:55 Z | dung3683833 | Rice Hub (IOI11_ricehub) | C++14 | 0 ms | 0 KB |
#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; }