QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 1024 MB 總分: 100 可 Hack ✓

#18581. Lấy phiếu bài tập

统计

Có $N$ học sinh muốn lấy tài liệu học tập đặt trên bàn giáo viên. Học sinh thứ $i$ mất $t_i$ giây để đi đến bàn giáo viên và mất $1$ giây để lấy tài liệu. Tuy nhiên, trong khi một học sinh đang lấy tài liệu, không học sinh nào khác có thể lấy tài liệu.

Bỏ qua thời gian quay trở về chỗ ngồi sau khi đã lấy tài liệu, hãy tính xem tất cả học sinh mất ít nhất bao nhiêu giây để lấy xong tài liệu.

Dữ liệu vào

Dòng đầu tiên chứa số lượng học sinh $N$. $(1\le N\le 1\,000)$

Dòng thứ hai chứa $N$ số nguyên $t_1, t_2, \dots, t_N$ cách nhau bởi dấu cách, biểu thị thời gian mỗi học sinh đi đến bàn giáo viên. $(1 \le t_i \le 10^5)$

Dữ liệu ra

In ra số giây tối thiểu để tất cả học sinh lấy xong tài liệu.

Ví dụ

Input 1

5
3 1 2 4 2

Output 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.