#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<=(int)b;i++)
#define FORD(i,a,b) for(int i=a;i>=(int)b;i--)
#define ll long long
#define fi first
#define se second
#define pb push_back
#define all(a) a.begin(),a.end()
#define BIT(mask,i) ((mask>>(i))&1)
#define MASK(a) (1LL<=((a)))
#define uni(v) sort(all(v)); v.resize(unique(all(v)) - v.begin())
#define pii pair <int, int>
#define vi vector <int>
#define vl vector <ll>
template <class A,class B>
bool maximize(A &a, const B b)
{
if(a < b){a = b; return 1;} return 0;
}
template <class A,class B>
bool minimize(A &a, const B b)
{
if(a > b){a = b; return 1;} return 0;
}
const int maxn = 2e5 + 5;
int n, m, k;
int s[maxn];
int A, B, C;
long long T;
namespace sub1
{
int dp[505][505], near[505];
bool mark[505];
int cost[505][505];
void solve()
{
FOR(i, 1, m) mark[s[i]] = true;
FOR(i, 1, n) near[i] = (mark[i] ? i : near[i - 1]);
FOR(i, 1, n)
{
int cnt = 0;
FOR(j, i, n)
{
int S = near[i];
long long TCost = 1LL * (S - 1) * B + 1LL * (i - S) * C + 1LL * (j - i) * A;
if(TCost <= T) cnt++;
cost[i][j] = cnt;
}
}
memset(dp,- 0x3f,sizeof dp);
dp[1][1] = 0;
FOR(i, 1, n) FOR(j, 1, k)
{
FOR(k, 1, i)
{
dp[i][j] = max(dp[i][j], dp[k][j - 1] + cost[k + 1][i]);
}
}
int ans = 0;
FOR(i, 1, n) ans = max(ans, dp[i][k]);
cout << ans;
}
}
void solve()
{
cin >> n >> m >> k >> A >> B >> C;
cin >> T;
FOR(i,1,m)cin>>s[i];
return sub1::solve();
}
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
#define kieuoanh "kieuoanh"
if(fopen(kieuoanh".inp","r"))
{
freopen(kieuoanh".inp","r",stdin);
freopen(kieuoanh".out","w",stdout);
}
int tst = 1;
// cin >> tst;
while(tst--) solve();
return 0;
}
Compilation message (stderr)
semiexpress.cpp: In function 'int main()':
semiexpress.cpp:88:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
88 | freopen(kieuoanh".inp","r",stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
semiexpress.cpp:89:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
89 | freopen(kieuoanh".out","w",stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |