#include<bits/stdc++.h>
using namespace std;
const int mx=100006;
const int mx2=2e5+9;
typedef long long ll;
const int mod=998244353 ;
const long long inf=1e8+10;
ll n,m,k;ll s[mx];
int main(){
cin>>n>>m>>k;
ll a,b,c;cin>>a>>b>>c;
ll t;cin>>t;ll ans=0;
for(int i=0;i<m;i++){
cin>>s[i];
}
if((n-1)*b<=t) ans++;
priority_queue<ll>q;
for(int i=0;i<m-1;i++){
ll tim=(s[i]-1)*b;
ll steps=(t-tim)/a;
ll range=min(s[i]+steps,s[i+1]-1);
if(tim>t){break;}
ans+=(range-s[i]+1);
// cout<<range<<endl;
range++;
if(i==0){ans--;}
for(int j=0;j<k&&range<=s[i+1]-1;j++){
ll tim2=tim+(range-s[i])*c;
if(tim2>t){break;}
ll steps2=(t-tim2)/(a);
ll range2=min(range+steps2,s[i+1]-1);
q.push(range2-range+1);
// cout<<range2<<" ";
range=range2;
range++;
}
//cout<<endl;
}
for(int i=m;i<k;i++){
if(!q.empty()){
ans+=q.top();
q.pop();
}
}
cout<<ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
204 KB |
Output is correct |
9 |
Correct |
0 ms |
204 KB |
Output is correct |
10 |
Correct |
0 ms |
204 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
0 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
0 ms |
204 KB |
Output is correct |
17 |
Correct |
0 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
1 ms |
204 KB |
Output is correct |
21 |
Correct |
4 ms |
2496 KB |
Output is correct |
22 |
Correct |
2 ms |
1476 KB |
Output is correct |
23 |
Correct |
11 ms |
8632 KB |
Output is correct |
24 |
Correct |
8 ms |
4540 KB |
Output is correct |
25 |
Correct |
1 ms |
204 KB |
Output is correct |
26 |
Correct |
1 ms |
204 KB |
Output is correct |
27 |
Correct |
27 ms |
16820 KB |
Output is correct |
28 |
Correct |
42 ms |
33220 KB |
Output is correct |
29 |
Correct |
10 ms |
4540 KB |
Output is correct |
30 |
Correct |
4 ms |
2496 KB |
Output is correct |