제출 #298605

#제출 시각아이디문제언어결과실행 시간메모리
298605reymontada61Semiexpress (JOI17_semiexpress)C++14
100 / 100
12 ms4592 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int n, m, k; int a, b, c; int t, extra; const int MXM = 3005; int pos[MXM]; int curr = 0; signed main() { cin >> n >> m >> k; cin >> a >> b >> c; cin >> t; for (int i=1; i<=m; i++) { cin >> pos[i]; } extra = k - m; priority_queue<int> pr; for (int i=1; i<m; i++) { int left = t - (pos[i] - 1) * b; if (left < 0) continue; int far = min(pos[i+1]-1, pos[i]+left/a); curr += (far - pos[i] + 1); int min_no = far + 1; int here = 1; bool can = true; while (min_no < pos[i+1] && here <= extra && can) { int ti = t - ((pos[i] - 1) * b + (min_no - pos[i]) * c); if (ti >= 0) { int far = min(min_no + ti / a, pos[i+1]-1); int hm = far - min_no + 1; pr.push(hm); here++; min_no = far + 1; } else { can = false; } } } curr--; { if (t - (pos[m] - 1) * b >= 0) { curr++; } } int best = 0; for (int i=0; i<extra; i++) { if (!pr.empty()) { best += pr.top(); pr.pop(); } } cout << best + curr << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...