Submission #869178

#TimeUsernameProblemLanguageResultExecution timeMemory
869178tvladm2009Semiexpress (JOI17_semiexpress)C++17
100 / 100
26 ms33992 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3000 + 7; ll stat[N]; ll n, m, k, a, b, c, t; int main() { #ifdef ONPC freopen("input.txt", "r", stdin); #endif // ONPC #ifndef ONPC ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #endif // ONPC cin >> n >> m >> k >> a >> b >> c >> t; for (int i = 0; i < m; i++) { cin >> stat[i]; } ll sol = 0; if ((n - 1) * b <= t) { sol++; } priority_queue<ll> pq; for (int i = 0; i < m - 1; i++) { ll tt = (stat[i] - 1) * b; if (tt > t) break; ll add = (t - tt) / a; ll range = min(stat[i + 1] - 1, stat[i] + add); sol += range - stat[i] + (i > 0); for (int j = 0; j < k && range < stat[i + 1] - 1; j++) { ll tmp = tt + (range + 1 - stat[i]) * c; if (tmp > t) break; ll qq = (t - tmp) / a; ll new_range = min(stat[i + 1] - 1, range + qq + 1); pq.push(new_range - range); range = new_range; } } for (int i = 1; i <= k - m; i++) { if (!pq.empty()) { sol += pq.top(); pq.pop(); } } cout << sol << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...