Submission #19272596


Source Code Expand

Copy
#include <iostream>
#include <queue>
#include <functional>
// #include <cstdint>

struct MachineState {
  int64_t cur_cost;
  int64_t increase;
};

bool operator>(const MachineState &state1, const MachineState &state2) {
  return state1.cur_cost > state2.cur_cost;
}

int main() {
  int64_t cur_cost, increase;
  size_t n_machine, n_present;
  std::cin >> n_machine >> n_present;

  std::priority_queue<MachineState, std::vector<MachineState>, std::greater<MachineState>> queue;
  for (size_t i = 0; i < n_machine; i++) {
    std::cin >> cur_cost >> increase;
    queue.push(MachineState{cur_cost, increase});
  }

  int64_t time = 0;
  for (size_t i = 0; i < n_present; i++) {
    MachineState state = queue.top();
    queue.pop();

    time += state.cur_cost;
    queue.push(MachineState{state.cur_cost + state.increase, state.increase});
  }

  std::cout << time << std::endl;
}

Submission Info

Submission Time
Task A - Time Penalty
User moyashi97
Language C++ (GCC 9.2.1)
Score 0
Code Size 918 Byte
Status WA
Exec Time 8 ms
Memory 3728 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 100
Status
AC × 1
WA × 2
AC × 1
WA × 9
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_2.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt
Case Name Status Exec Time Memory
sample_01.txt WA 7 ms 3556 KB
sample_02.txt WA 4 ms 3728 KB
sample_03.txt AC 3 ms 3604 KB
subtask_1_1.txt WA 8 ms 3556 KB
subtask_1_2.txt WA 2 ms 3552 KB
subtask_1_3.txt WA 2 ms 3524 KB
subtask_1_4.txt WA 2 ms 3536 KB
subtask_1_5.txt WA 2 ms 3604 KB
subtask_1_6.txt WA 3 ms 3728 KB
subtask_1_7.txt WA 4 ms 3700 KB