#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
int main() {
int N, M, K;
cin >> N >> M >> K;
long long A, B, C;
cin >> A >> B >> C;
long long T;
cin >> T;
vector<int> S(M);
for (int i = 0; i < M; ++i) {
cin >> S[i];
}
// Calculate the maximum number of reachable stations
long long result = 0;
// Iterate through each segment between express stops
for (int i = 0; i < M - 1; ++i) {
int start = S[i];
int end = S[i + 1];
// Calculate the time to reach the start of the segment
long long time_to_start = (start - 1) * B;
// If the time to reach the start is already greater than T, skip
if (time_to_start > T) {
continue;
}
// Calculate the remaining time for this segment
long long remaining_time = T - time_to_start;
// Calculate the maximum number of stations reachable in this segment
long long max_stations = min((long long)(end - start), remaining_time / C);
// Add the number of reachable stations
result += max_stations;
// Update the remaining time
remaining_time -= max_stations * C;
// Calculate the additional stations reachable by local train
long long additional_stations = min((long long)(end - start - max_stations), remaining_time / A);
// Add the additional stations
result += additional_stations;
}
// Output the result
cout << result << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |