QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22692. 宿題の提出

Statistics

Bessie は Moo U の $C$ 授業($1 \le C \le 1{,}000$)の宿題を提出し、帰宅バス待ちに同級生と反芻する時間を確保します。

先生は授業終了、黒板掃除、実験用品片付けなどの後だけ受理。入力に最早受理時刻があります。

長さ $H$ メートル($1 \le H \le 1{,}000$)の廊下の端、距離 $0$ から秒速一メートル、任意の順で教室へ提出。教室もバス待合への扉も廊下にあります。

出口/教室位置と先生の予定から、最早の待合への退出時刻を求めます。先に全提出が必要、提出自体は時間ゼロ。

入力

  • 1 行目:整数 $C$、$H$、$B$。$B$($0 \le B \le H$)は入口から待合までの距離。
  • $2..C+1$ 行目:提出教室ごと二整数、最初($0..H$)は入口からのメートル数、次($0..10,000$)はその先生の最早受理秒。

出力

  • 1 行目:退出できる最早秒、一整数。

入出力例

入力 1

4 10 3
8 9
4 21
3 16
8 12

出力 1

22

注記

時刻 行動
$0$ Bessie は廊下$8$メートルの教室へ(位置$8$m)
$8$ $1$秒待つ
$9$ 最初の宿題を提出
$9$ $3$秒待ち、夏の涼しい干し草を考える
$12$ この場所の別の宿題を提出
$12$ 廊下$4$メートルの教室へ戻る(位置$4$m)
$16$ $5$秒待ち、会ったことのある格好いい雄牛を考える
$21$ 宿題提出
$21$ 廊下$1$メートルの教室へ戻る(位置$3$m)
$22$ 宿題提出
$22$ ここはバス出口でもあり退出

よって $22$ に退出でき、より良い予定はありません。

問題の謝辞:Hal Burch、2004

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.