#include <numeric>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#include <time.h>
#define Endl endl
#define mp make_pair
#define mt make_tuple
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define quickcin ios_base::sync_with_stdio(false);
const int mod=1000000007;
const int gmod=3;
const int inf=1039074182;
const double eps=1e-9;
const double pi=3.141592653589793238462643383279;
const ll llinf=2LL*inf*inf;
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
inline void chadd(int &x,int b) {x+=b-mod;x+=(x>>31 & mod);}
template <typename T1,typename T2> inline void chadd(T1 &x,T2 b) {x+=b;if(x>=mod) x-=mod;}
template <typename T1,typename T2> inline void chmul(T1 &x,T2 b) {x=1LL*x*b%mod;}
template <typename T1,typename T2> inline void chmod(T1 &x,T2 b) {x%=b,x+=b;if(x>=b) x-=b;}
template <typename T> inline T mabs(T x) {return (x<0?-x:x);}
using namespace std;
int n,m,k;
ll a,b,c;
ll T;
int dp[3005][3005];
int s[3005];
int rm[3005];
ll t[3005];
inline int calc(int rm,ll t)
{
if(t>T) return 0;
return max(0LL,min((ll)rm,(T-t)/a+1));
}
inline int calc2(int rm,ll t)
{
int steps=calc(rm,t);
return calc(rm-steps,t+steps*c)+steps;
}
int main()
{
// freopen("input.txt","r",stdin);
freopen("car.in","r",stdin);
freopen("car.out","w",stdout);
cin>>n>>m>>k>>a>>b>>c>>T;
for(int i=0;i<m;i++) scanf("%d",s+i),s[i]--;
k-=m;
m--;
for(int i=0;i<m;i++) rm[i]=s[i+1]-s[i];
for(int i=0;i<m;i++) t[i]=s[i]*b;
while(k--)
{
int ch=0;
for(int i=1;i<m;i++)
{
if(calc2(rm[ch],t[ch])<calc2(rm[i],t[i])) ch=i;
}
// if(ch==1) cout<<rm[1]<<','<<t[1]<<endl;
int steps=calc(rm[ch],t[ch]);
rm[ch]-=steps;
t[ch]+=steps*c;
}
ll ans=n;
for(int i=0;i<m;i++) ans-=rm[i]-calc(rm[i],t[i]);
ans--;
ans-=(b*(n-1)>T);
cout<<ans<<endl;
return 0;
}
Compilation message
semiexpress.cpp: In function 'int main()':
semiexpress.cpp:63:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
63 | freopen("car.in","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:64:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
64 | freopen("car.out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:66:28: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
66 | for(int i=0;i<m;i++) scanf("%d",s+i),s[i]--;
| ~~~~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |