QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓

#18581. 学習プリントを持ってくる

Estadísticas

$N$人の学生が教卓に置かれた学習プリントを取りに行こうとしている。$i$番目の学生は教卓に行くのに $t_i$ 秒かかり、プリントを手に取るのに $1$ 秒かかる。ただし、ある学生がプリントを手に取っている間は、他の学生はプリントを手に取ることができない。

プリントを手に取った後に席に戻る時間は無視できるものとして、すべての学生がプリントを手に取り終えるまでにかかる最小の時間を求めよ。

入力

1行目に学生の数 $N$ が与えられる。 $(1\le N\le 1\,000)$

2行目に各学生が教卓に行くまでにかかる時間を表す $N$ 個の整数 $t_1, t_2, \dots, t_N$ が空白区切りで与えられる。 $(1 \le t_i \le 10^5)$

出力

すべての学生が学習プリントを手に取り終えるまでにかかる最小の時間を秒単位で出力せよ。

入出力例

入力 1

5
3 1 2 4 2

出力 1

6

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.