Submission #241194

#TimeUsernameProblemLanguageResultExecution timeMemory
241194aggu_01000101Semiexpress (JOI17_semiexpress)C++14
100 / 100
31 ms4596 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...