Submission #521875

#TimeUsernameProblemLanguageResultExecution timeMemory
521875AdamGSSemiexpress (JOI17_semiexpress)C++17
100 / 100
13 ms4548 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define rep(a, b) for(int a = 0; a < (b); ++a) #define st first #define nd second #define pb push_back #define all(a) a.begin(), a.end() vector<ll>V; ll n, m, k, a, b, c, t, ans; void solve(ll dl, ll czas) { if(czas<0) return; ll p=min(czas/a+1, dl); ans+=p; dl-=p; czas-=c*p; rep(i, k) { if(dl<=0 || czas<0) return; p=min(czas/a+1, dl); V.pb(p); czas-=c*p; dl-=p; } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m >> k >> a >> b >> c >> t; k-=m; ll lst=-1; rep(i, m) { ll p; cin >> p; if(i) solve(p-lst, t-(lst-1)*b); lst=p; } solve(1, t-(n-1)*b); sort(all(V)); reverse(all(V)); rep(i, k) if(i<V.size()) ans+=V[i]; cout << ans-1 << '\n'; }

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:39:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  rep(i, k) if(i<V.size()) ans+=V[i];
      |               ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...