Submission #756855

#TimeUsernameProblemLanguageResultExecution timeMemory
7568551binSemiexpress (JOI17_semiexpress)C++14
100 / 100
15 ms340 KiB
#include <bits/stdc++.h> using namespace std; #define all(v) v.begin(), v.end() typedef long long ll; ll n, m, k, A, B, C, T, s[2003], a, b, mx, ans; priority_queue<ll> pq; int main(void){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m >> k; k -= m; cin >> A >> B >> C >> T; for(int i = 0; i < m; i++) cin >> s[i]; s[m] = n + 1; for(int i = 0; i < m; i++){ if(T < 0) break; mx = s[i + 1] - s[i]; a = min(T / A + 1, mx); ans += a; for(int x = 1; x <= k; x++){ if(T < a * C || a == mx) break; b = min((T - a * C) / A + 1, mx - a); pq.emplace(-b); if(pq.size() > k) pq.pop(); a += b; } T -= B * (s[i + 1] - s[i]); } while(pq.size()){ ans += -pq.top(); pq.pop(); } cout << ans - 1; return 0; }

Compilation message (stderr)

semiexpress.cpp: In function 'int main()':
semiexpress.cpp:28:26: warning: comparison of integer expressions of different signedness: 'std::priority_queue<long long int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   28 |             if(pq.size() > k) pq.pop();
      |                ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...