Submission #769965

#TimeUsernameProblemLanguageResultExecution timeMemory
769965gun_ganSemiexpress (JOI17_semiexpress)C++17
100 / 100
37 ms16952 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int MX = 3005; ll N, M, K; ll A, B, C, T; ll s[MX]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> N >> M >> K; cin >> A >> B >> C; cin >> T; for(int i = 1; i <= M; i++) cin >> s[i]; ll ans = -1, cur = 0; K -= M; vector<ll> v; for(int i = 1; i < M; i++) { if(cur > T) break; ll ccur = cur, pos = s[i]; for(int j = 0; j <= K; j++) { if(ccur > T) break; ll d = min(s[i + 1] - pos, (T - ccur) / A + 1); if(!j) ans += d; else v.push_back(d); if((T - ccur) / A + 1 >= s[i + 1] - s[i]) break; ccur += C * d; pos += d; } cur += B * (s[i + 1] - s[i]); } if(cur <= T) ans += 1; sort(v.rbegin(), v.rend()); for(int i = 0; i < min(K, (ll) v.size()); i++) ans += v[i]; cout << ans << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...