제출 #68296

#제출 시각아이디문제언어결과실행 시간메모리
68296NurlykhanSemiexpress (JOI17_semiexpress)C++17
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> #define pb push_back #define all(v) v.begin(), v.end() #define sz(v) int(v.size()) #define pii pair<int, int> #define mp make_pair #define f first #define ll long long #define ld long double #define s second #define vec vector<int> using namespace std; const int N = (int) 2e3 + 100; const int M = (int) 2018 * 2018; const int K = (int) 10; const int INF = (int) 1e9 + 7; const int mod = (int) 998244353; const ld EPS = (ld) 1e-9; const ll LINF = (ll) 1e18; ll n, m, k; ll A, B, C, T; ll x[N]; ll dist[N], L[N]; int main() { #ifdef sony freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif srand(time(0)); cin >> n >> m >> k; cin >> A >> B >> C; cin >> T; ll ans = 0; for (int i = 1; i <= m; i++) { cin >> x[i]; } for (int i = 1; i <= m; i++) { if (x[i] > 1 && T - (x[i] - 1) * B >= 0) ans++; dist[i] = (T - (x[i] - 1) * B) / A; if (dist[i] < 0) continue; ll l = x[i] + dist[i] + 1, r = x[i + 1] - 1; L[i] = min(l, r); } for (int iter = 1; iter <= k - m; iter++) { int id = -1; ll mx = 0; for (int i = 1; i < m; i++) { if (dist[i] < 0) continue; // put express at L[i] and count how much will be added ll cost = T - ((x[i] - 1) * B + (L[i] - x[i]) * C); if (cost < 0) continue; ll cnt = min(x[i + 1] - 1 - L[i], cost / A) + 1; // (l,l+cost/A) if (cnt > mx) { mx = cnt; id = i; } } if (id == -1) break; //cout << " optimus " << id << ' ' << mx << endl; ll cost = T - ((x[id] - 1) * B + (L[id] - x[id]) * C); ll cnt = min(x[id + 1] - 1 - L[id], cost / A) + 1; // (l,l+cost/A) L[id] += cnt; } for (int i = 1; i < m; i++) { //cout << L[i] << ' ' << x[i] << endl; if (dist[i] >= 0) ans += max(0ll, L[i] - x[i] - 1); } cout << ans; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...