This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (stderr)
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |