#include <bits/stdc++.h>
#define int long long
#define INF 100000000
using namespace std;
int n, m, k, a, b, c, t;
int s[3005];
bool cmp(int a, int b){
return a>b;
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n>>m>>k>>a>>b>>c>>t;
for(int i = 0;i<m;i++) cin>>s[i], s[i]--;
vector<int> poss;
int ans = 0;
for(int i = 0;i<(m-1) && (s[i]*b <= t);i++){
int DistanceToStation = s[i]*b;
int RemainingDistance = t - DistanceToStation;
int ExtraVisited = min(s[i+1] - s[i] - 1, RemainingDistance/a);
ans += (1 + ExtraVisited);
int SemiExpressDistance = ExtraVisited + 1;
int SemiUsed = 0;
while(((SemiExpressDistance + s[i]) < s[i+1]) && ((SemiExpressDistance*c + DistanceToStation)<=t) && SemiUsed < (k-m)){
int Adding = min(s[i+1] - SemiExpressDistance - s[i] - 1, (t - SemiExpressDistance*c - DistanceToStation)/a);
poss.push_back(Adding + 1);
SemiUsed++;
SemiExpressDistance += (Adding + 1);
}
}
if(s[m-1]*b <= t) ans++;
ans--;
k-=m;
sort(poss.begin(), poss.end(), cmp);
for(int i = 0;i<poss.size() && i<k;i++) ans+=poss[i];
cout<<ans<<endl;
}
Compilation message
semiexpress.cpp: In function 'int main()':
semiexpress.cpp:35:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i = 0;i<poss.size() && i<k;i++) ans+=poss[i];
~^~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 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 |
384 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 |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 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 |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 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 |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 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 |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
4 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
5 ms |
384 KB |
Output is correct |
20 |
Correct |
5 ms |
384 KB |
Output is correct |
21 |
Correct |
5 ms |
384 KB |
Output is correct |
22 |
Correct |
6 ms |
640 KB |
Output is correct |
23 |
Correct |
31 ms |
4596 KB |
Output is correct |
24 |
Correct |
5 ms |
512 KB |
Output is correct |
25 |
Correct |
5 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
384 KB |
Output is correct |
27 |
Correct |
5 ms |
384 KB |
Output is correct |
28 |
Correct |
5 ms |
384 KB |
Output is correct |
29 |
Correct |
21 ms |
4596 KB |
Output is correct |
30 |
Correct |
14 ms |
2552 KB |
Output is correct |