답안 #751790

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
751790 2023-06-01T13:07:23 Z tch1cherin Semiexpress (JOI17_semiexpress) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve() {
  int N, M, K;
  cin >> N >> M >> K;
  int A, B, C;
  cin >> A >> B >> C;
  long long T;
  cin >> T;
  vector<int> S(M);
  for (auto &v : S) {
    cin >> v;
    v--;
  }
  set<tuple<long long, int, int>> s;
  for (int i = 0; i < M; i++) {
    s.emplace(1ll * S[i] * B, S[i], i);
  }
  long long ans = -1;
  for (int i = 0; i < K && !s.empty(); i++) {
    auto [time, position, j] = *s.begin();
    s.erase(s.begin());
    if (time > T) {
      break;
    }
    long long pos = position + (T - time) / A + 1;
    bool bad = false;
    if (pos >= N) {
      pos = N;
      bad = true;
    }
    if (j + 1 < M && S[j + 1] <= pos) {
      pos = S[j + 1];
      bad = true;
    }
    ans += pos - position;
    if (!bad) {
      s.emplace(1ll * S[j] * B + 1ll * (pos - S[j]) * C, pos, j);
    } 
  }
  cout << ans << "\n";
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}

Compilation message

cc1plus: error: '::main' must return 'int'