#include <bits/stdc++.h>
#define ll long long
using namespace std;
int n,m,k;
ll s[3005];
ll T, A, B ,C;
typedef pair<ll,ll> ii;
#define fi first
#define se second
struct cmp{
bool operator () (ii a,ii b){
// fi = time left
// b = station left
ll val1 = min(a.fi / A, a.se);
ll val2 = min(b.fi / A, b.se);
if (val1 == val2) return a.fi < b.fi;
return val1 < val2;
}
};
priority_queue <ii,vector<ii>,cmp> pq;
int main(){
iostream::sync_with_stdio(0);
cin >> n >> m >> k;
cin >> A >> B >> C;
cin >> T;
for(int i=1;i<=m;i++) cin >> s[i];
for(int i=1;i<m;i++){
if (T < (s[i]-1) * B) break;
pq.push(ii(T - (s[i]-1)*B, s[i+1] - s[i] - 1));
}
int ans = 0;
for(int i=1;i<=m;i++) ans += (T >= (s[i]-1) * B);
k -= m;
//cout << ans << endl;
while(k-- && pq.size()){
ii u = pq.top();
pq.pop();
ll time_left = u.fi;
ll station_left = u.se;
//cout << time_left << ' ' << station_left << endl;
ll passable_station = min(station_left, time_left / A);
ans += passable_station;
time_left -= passable_station * C;
if (time_left < C || passable_station == station_left) continue;
ans ++;
time_left -= C;
pq.push(ii(time_left, station_left - passable_station - 1));
//cout << ans << endl;
}
cout << ans - 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2200 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2200 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
2200 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |