#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int (i)=int(a);i<=int (b);i++)
#define ff(i,a,b) for(int (i)=int (a);i<int(b);i++)
#define F(i,a,b) for(int (i)=int (a);i>=int (b);i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ll long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
const double eps=1e-5,pi=acos(-1.0);
const int N=1e6+6,inf=1<<30,mod=1e9+7;
ll n,m,k,a,b,c,t;
ll ex[N],ans=0;
priority_queue<int> heap;
int main(){
cin>>n>>m>>k>>a>>b>>c>>t;
ff(i,0,m){
cin>>ex[i];
}
if((n-1)*b<=t) ans++;
ff(i,0,m-1){
ll iti=(ex[i]-1)*b;
if(iti>t) continue;
ll qtq=(t-iti)/a;
ll range=min(ex[i+1]-1,ex[i]+qtq);
ans+=range-ex[i]+1;
if(i==0) ans--;
for(int j=0;j<k&&range<ex[i+1]-1;j++){
ll tm=iti+(range-ex[i]+1)*c;
if(tm>t) continue;
ll q=(t-tm)/a;
ll new_range=min(range+1+q,ex[i+1]-1);
heap.push(new_range-range);
range=new_range;
}
}
for(int i=m;i<k;i++){
if(heap.empty()) break;
ans+=heap.top();
heap.pop();
}
cout<<ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
256 KB |
Output is correct |
17 |
Correct |
5 ms |
512 KB |
Output is correct |
18 |
Correct |
5 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
256 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
256 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
256 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
4 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
256 KB |
Output is correct |
17 |
Correct |
5 ms |
512 KB |
Output is correct |
18 |
Correct |
5 ms |
256 KB |
Output is correct |
19 |
Correct |
6 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
8 ms |
1560 KB |
Output is correct |
22 |
Correct |
7 ms |
1020 KB |
Output is correct |
23 |
Correct |
15 ms |
4592 KB |
Output is correct |
24 |
Correct |
13 ms |
2548 KB |
Output is correct |
25 |
Correct |
6 ms |
384 KB |
Output is correct |
26 |
Correct |
6 ms |
384 KB |
Output is correct |
27 |
Correct |
32 ms |
8684 KB |
Output is correct |
28 |
Correct |
39 ms |
16992 KB |
Output is correct |
29 |
Correct |
12 ms |
2548 KB |
Output is correct |
30 |
Correct |
7 ms |
1528 KB |
Output is correct |