Submission #110167

#TimeUsernameProblemLanguageResultExecution timeMemory
110167WLZSemiexpress (JOI17_semiexpress)C++17
18 / 100
3 ms384 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n; int m, k; cin >> n >> m >> k; long long a, b, c; cin >> a >> b >> c; long long t; cin >> t; vector<long long> s(m); for (int i = 0; i < m; i++) { cin >> s[i]; } long long ans = 0; if ((n - 1) * b <= t) { ans++; } priority_queue<long long> pq; for (int i = 0; i < m - 1; i++) { long long need = (s[i] - 1) * b; if (need > t) { break; } long long q = (t - need) / a; long long to = min(s[i] + q, s[i + 1] - 1); ans += to - s[i] + 1; to++; for (int j = 0; j < k && to < s[i + 1]; j++) { if (need + (to - s[i]) * c > t) { break; } q = (t - need - (to - s[i]) * c) / a; if (to + q >= s[i + 1]) { break; } to += q + 1; pq.push(q + 1); } } for (int i = 0; i < k - m && !pq.empty(); i++) { ans += pq.top(); pq.pop(); } ans--; cout << ans << '\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...