#include using namespace std; typedef long long ll; typedef pair pii; #define pb push_back #define all(a) a.begin(), a.end() #define sz(a) ((int)a.size()) #ifdef Doludu template ostream& operator << (ostream &o, vector vec) { o << "{"; int f = 0; for (T i : vec) o << (f++ ? " " : "") << i; return o << "}"; } void bug__(int c, auto ...a) { cerr << "\e[1;" << c << "m"; (..., (cerr << a << " ")); cerr << "\e[0m" << endl; } #define bug_(c, x...) bug__(c, __LINE__, "[" + string(#x) + "]", x) #define bug(x...) bug_(32, x) #define bugv(x...) bug_(36, vector(x)) #define safe bug_(33, "safe") #else #define bug(x...) void(0) #define bugv(x...) void(0) #define safe void(0) #endif const int mod = 998244353, N = 2000006; int main() { ios::sync_with_stdio(false), cin.tie(0); int n, l, k; cin >> n >> l >> k; vector a = {0}; for (int i = 0, x; i < n; ++i) { cin >> x; a.pb(x); } a.pb(l); auto ask = [&](int x) { vector dp(sz(a), vector(3, -1 << 30)); dp[0][0] = 0; for (int i = 0, pos = 0; i + 1 < sz(a); ++i) { for (int j = 0; j <= 2; ++j) { dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + 1); } while (pos < sz(a) && a[pos] < a[i] + x) pos++; if (pos < sz(a)) { for (int j = 0; j < 2; ++j) { dp[pos][j + 1] = max(dp[pos][j + 1], dp[i][j] + 1); } } } int ans = dp[sz(a) - 1][2]; bug(x, ans); return ans >= k + 1; }; int L = 0, R = l + 1; while (R - L > 1) { int m = L + R >> 1; if (ask(m)) L = m; else R = m; } cout << L << "\n"; }