//by szh
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}
const int maxn = 3010;
int n,m,K;
ll A,B,C,T;
ll stop[maxn];
int nxt[maxn],tmpnxt[maxn];
int main() {
// freopen("input.txt","r",stdin);
std::ios::sync_with_stdio(false);cin.tie(0);
cin>>n>>m>>K>>A>>B>>C>>T;
rep(i,0,m) cin>>stop[i];
int ans = 0;
ll sum;
rep(i,0,m-1) {
sum=B*(stop[i]-1);
if (sum<=T and i!=0) ans++;
if (sum>=T) {
nxt[i] = -1;
continue;
}
ll tmp = min(stop[i+1]-stop[i]-1,(T-sum)/A);
ans+=tmp;
nxt[i] = stop[i]+tmp+1;
}
if (B*stop[m-1]<=T) ans++;
// debug(ans);
rep(_,0,K-m) {
ll val=0;
int pos=-1;
rep(i,0,m-1) {
if (nxt[i]==-1 or nxt[i]==stop[i+1]) continue;
ll tt = B*(stop[i]-1)+C*(nxt[i]-stop[i]);
if (tt>T) continue;
ll tmp = min((T-tt)/A,stop[i+1]-nxt[i]-1);
tmpnxt[i] = nxt[i] + tmp+1;
if (tmp+1>val) {
val = tmp+1;
pos = i;
}
}
if (val==0) break;
ans += val;
// debug(val);
nxt[pos] = tmpnxt[pos];
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Incorrect |
0 ms |
320 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Incorrect |
0 ms |
320 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Incorrect |
0 ms |
320 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |