#include <bits/stdc++.h>
#define IO_OP ios::sync_with_stdio(0), cin.tie(0)
#define F first
#define S second
#define V vector
#define PB push_back
#define EB emaplce_back
#define MP make_pair
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
const int INF = 1e9 + 7, N = 3005;
int s[N];
signed main()
{
IO_OP;
int n, m, k, a, b, c;
ll t;
cin >> n >> m >> k >> a >> b >> c >> t;
assert(k >= m);
k -= m;
int ans = 0;
for(int i = 0; i < m; i++) {
cin >> s[i];
}
vi tt;
for(int i = 0; i < m - 1; i++) {
ll now = 1LL * (s[i] - 1) * b;
int pos = s[i];
vi aux;
while(now <= t && pos < s[i + 1]) {
// now + a * x <= t
// pos + x < s[i + 1]
ll x = min<ll>((t - now) / a, s[i + 1] - pos - 1);
aux.PB(x + 1);
pos = pos + x + 1;
now += 1LL * (x + 1) * c;
}
if(aux.size()) {
ans += aux[0];
for(int i = 1; i < int(aux.size()); i++)
tt.PB(aux[i]);
}
}
if(1LL * s[m - 1] * b <= t)
ans++;
sort(ALL(tt), greater<int>());
for(int i = 0; i < min(int(tt.size()), k); i++)
ans += tt[i];
ans--;
cout << ans << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
0 ms |
208 KB |
Output is correct |
7 |
Incorrect |
0 ms |
208 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |