#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 - 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 |
416 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 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 |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
416 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 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 |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
416 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 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 |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
512 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
14 |
Halted |
0 ms |
0 KB |
- |