이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |