Submission #446819

#TimeUsernameProblemLanguageResultExecution timeMemory
446819ritul_kr_singhSemiexpress (JOI17_semiexpress)C++17
100 / 100
47 ms344 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int n, m, k, a, b, c, t, s[3000], ans, pre; priority_queue<int> q; signed main(){ cin.tie(0)->sync_with_stdio(0); cin >> n >> m >> k >> a >> b >> c >> t; for(int i=0; i<m; ++i) cin >> s[i]; for(int i=0; i+1<m; ++i){ int diff = s[i+1] - s[i]; for(int j=0, x=0; j<=k-m; ++j){ int v = min(diff - x, (t - x*c + a) / a); if(v < 0) break; ans += v, x += v; if(j){ q.push(-v); if(size(q) > k-m) ans += q.top(), q.pop(); } } t -= diff * b; } cout << ans - 1 + (0 <= t); }

Compilation message (stderr)

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