PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000363. Kho tập kết lúa (Rice Hub)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Kho tập kết lúa (Rice Hub)

Rice Hub

Source: IOI

Version: Phuoc Hung OJ Extended

Problem Statement

Along a straight rural road are RR rice fields, numbered 00 through R−1R-1. Field ii is at integer coordinate XiX_i between 11 and LL. The coordinates are given in nondecreasing order; different fields may occupy the same position.

Each field supplies one truckload per harvest. A single collection hub may be placed at any integer coordinate hh between 11 and LL, even at an occupied field location. Transporting one truckload from field ii costs ∣Xi−h∣|X_i-h| baht.

Select any subset of fields and a hub location so that total transport expenditure is at most BB baht. Find the largest number of truckloads that can be collected.

Input

The first line contains three integers R,L,BR,L,B: the number of fields, the maximum coordinate and the budget.

The second line contains RR integers X0,X1,…,XR−1X_0,X_1,\ldots,X_{R-1} in nondecreasing order.

Output

Print one integer: the maximum number of truckloads that can be collected.

Subtasks

  • Subtask 1 (17 points): 1≤R≤1001\le R\le 100; 1≤L≤1001\le L\le 100; 0≤B≤100000\le B\le 10000; 1≤X0≤⋯≤XR−1≤L1\le X_0\le\cdots\le X_{R-1}\le L. All coordinates are distinct.
  • Subtask 2 (25 points): 1≤R≤5001\le R\le 500; 1≤L≤100001\le L\le 10000; 0≤B≤10000000\le B\le 1000000; 1≤X0≤⋯≤XR−1≤L1\le X_0\le\cdots\le X_{R-1}\le L.
  • Subtask 3 (26 points): 1≤R≤50001\le R\le 5000; 1≤L≤10000001\le L\le 1000000; 0≤B≤20000000000\le B\le 2000000000; 1≤X0≤⋯≤XR−1≤L1\le X_0\le\cdots\le X_{R-1}\le L.
  • Subtask 4 (32 points): 1≤R≤1000001\le R\le 100000; 1≤L≤10000000001\le L\le 1000000000; 0≤B≤20000000000000000\le B\le 2000000000000000; 1≤X0≤⋯≤XR−1≤L1\le X_0\le\cdots\le X_{R-1}\le L.

Examples

Input

5 20 6
1 2 10 12 14

Output

3

Sample

Explanation

A hub at 12 serves fields 10,12,14 at cost 2+0+2=4 baht. The two consecutive groups of four have minimum distance sums 19 and 14 respectively, both over six. Hence three truckloads is optimal.