#include<bits/stdc++.h>
#define f first
#define int long long
#define s second
using namespace std;
const int N=2e5+5,mod=1e9+7;
int t,s[N],ans;
set<pair<int,pair<int,int> > > st;
main(){
int n,m,k,a,b,c,T;
cin>>n>>m>>k;
cin>>a>>b>>c;
cin>>T;
for(int i=1;i<=m;i++){
cin>>s[i];
}
if((s[m]-1)*b <=T)ans++;
for(int i=1;i<m;i++){
int cur=s[i];
int timer=(s[i]-1)*b;
if(timer>T) continue;
ans += min(s[i+1]-s[i],(T-timer)/a+1);
cur = s[i] + min(s[i+1]-s[i],(T-timer)/a+1);
if(cur>=s[i+1]) continue;
timer+=c*(cur-s[i]);
if(timer> T) continue;
st.insert({min(s[i+1]-cur,(T-timer)/a+1),{i,cur+min(s[i+1]-cur,(T-timer)/a+1)}});
}
k-=m;
while(k && st.size()){
pair<int,pair<int,int> > p = *--st.end();
int i = p.s.f;
int adds=p.f; ans+=adds;
int cur=p.s.s;
int timer=(s[i]-1)*b+(cur-s[i])*c;
st.erase(p);
if(timer>T || cur>=s[i+1]) continue;
adds = min(s[i+1]-cur,(T-timer)/a+1);
cur += adds; k--;
if(cur>=s[i+1]) continue;
st.insert({adds,{i,cur}});
}
cout<<ans-1;
}
Compilation message
semiexpress.cpp:9:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
9 | main(){
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |