#P3697. 开心派对小火车

    ID: 1056 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>贪心优先队列概率论,统计洛谷月赛

开心派对小火车

Description

Aqours Railway Company has NN stations, numbered 1, 2, ..., NN.

There are two types of trains: Local (stops at every station) and Express. The express train stops at S1,S2,...,SMS_1, S_2, ..., S_M (1=S1<S2<...<SM=N1 = S_1 < S_2 < ... < S_M = N), for a total of MM stations.

Between two adjacent stations (i.e., the station numbered ii and the station numbered i+1i+1, not two consecutive express stops), the local takes AA minutes and the express takes BB minutes. We assume trains run at constant speed, ignoring dwell times and acceleration/deceleration.

Now we add a new Rapid train. It must include all express stops among its stops, and it takes CC minutes to travel between two adjacent stations. To be faster, it will stop at exactly KK stations (K>MK > M), including all express stations. If a station is served by multiple train types, passengers can transfer at that station. However, they can only travel forward, not backward.

You need to design a stopping pattern for the rapid train so that, within TT minutes of in-train time (waiting and transfer times are not counted), a passenger starting from station 1 can reach as many stations as possible. You only need to report how many stations can be reached.

Input Format

The first line contains three integers NN, MM, KK, as described above.

The second line contains three integers AA, BB, CC, as described above.

The third line contains one integer TT, the riding time.

Then MM lines follow, each containing one integer. The ii-th integer is SiS_i.

Output Format

Output a single integer, the maximum number of stations that can be reached within the time limit.

10 3 5
10 3 5
30
1
6
10

8

Hint

[Sample explanation]

You can set the rapid stops to be 1/5/6/8/10.

Stations 2, 3, 4 can be reached directly by taking the local. Station 5 can be reached by taking the rapid. Stations 6 and 10 can be reached by taking the express. Station 7 can be reached by transferring at 6 to the local, and station 8 can be reached by transferring at 6 to the rapid. Station 9 cannot be reached within 30 minutes of riding time.

Constraints

  • For 20% of the testdata, N300N \le 300, KM=2K - M = 2, A106A \le 10^6, T109T \le 10^9.
  • For 50% of the testdata, N1000N \le 1000.
  • For 100% of the testdata, 2N1092 \le N \le 10^9, 2MK30002 \le M \le K \le 3000, 1B<C<A1091 \le B < C < A \le 10^9, 1T10181 \le T \le 10^{18}.

Translated by ChatGPT 5