QOJ.ac

QOJ

Time Limit: 10 s Memory Limit: 1024 MB Total points: 100

#2168. 任务

Statistics

为了在 ICPC 全球总决赛前放松一下,你决定玩一款名为《任务》(Quests)的电脑游戏。你已经玩过几次了,现在你想完成一次完美的通关,为决赛的完美表现做准备!

在游戏中,你需要完成一系列任务,每完成一个任务都会获得经验值(XP)。你所获得的经验值总数决定了你当前的等级。每获得 $v$ 点经验值,你就会升一级。形式化地讲,你在任何时刻的等级 $L$ 是满足你拥有至少 $L \cdot v$ 点经验值的最大整数。

每个任务都有一个经验值 $x$ 和一个目标难度等级 $d$。如果你在等级达到 $d$ 或以上时完成任务,你将获得 $x$ 点经验值。然而,如果你在等级低于 $d$ 时完成任务,你将获得 $c \cdot x$ 点经验值。常数 $c$ 是一个经验值乘数,用于奖励在低于推荐难度等级 $d$ 时完成任务的行为。

你熟知所有 $n$ 个任务及其各自的 $x$ 和 $d$ 数值(你也知道 $v$ 和 $c$ 的值——你玩过很多次这个游戏)。你也有足够的技术完成任何任务,无论其目标难度等级如何,也无论你当前处于什么等级。你希望以某种顺序完成所有任务,从而获得尽可能多的经验值。

例如,在样例输入中,你可以获得的最大经验值为 43,具体操作如下:首先完成第二个任务(你获得 4 点经验值,因为你处于 0 级,且完成了一个目标难度等级为 2 的任务)。然后完成第一个任务(你获得 30 点经验值,因为你仍处于 0 级,且目标难度等级为 1)。此时你拥有 34 点经验值,等级变为 3。最后,完成第三个任务(你获得 9 点经验值,没有乘数加成,因为你已经达到 3 级)。

输入格式

输入的第一行包含三个整数 $n$、$v$ 和 $c$,其中 $n$ ($1 \le n \le 2\,000$) 是游戏中的任务数量,$v$ ($1 \le v \le 2\,000$) 是达到每一级所需的经验值,$c$ ($2 \le c \le 2\,000$) 是在达到目标难度等级之前完成任务的经验值乘数。

接下来有 $n$ 行,每行包含两个整数 $x$ 和 $d$,描述一个任务,其中 $x$ ($1 \le x \le 2\,000$) 是你在达到或超过其目标难度等级时完成该任务获得的经验值,$d$ ($1 \le d_i \le 10^6$) 是该任务的目标难度等级。

输出格式

输出完成所有任务后可能获得的最大经验值总数。

样例

样例输入 1

3 10 2
15 1
2 2
9 1

样例输出 1

43

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.