CSES - Reading Books
Xem dạng PDF
Gửi bài giải
Điểm:
1,00 (OI)
Giới hạn thời gian:
1.0s
Giới hạn bộ nhớ:
512M
Input:
stdin
Output:
stdout
Nguồn bài:
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
There are ~n~ books, and Kotivalo and Justiina are going to read them all. For each book, you know the time it takes to read it.
They both read each book from beginning to end, and they cannot read a book at the same time. What is the minimum total time required?
Input
- The first input line has an integer ~n~: the number of books.
The second line has ~n~ integers ~t\_1,t\_2,\dots,t\_n~: the time required to read each book.
Output
- Print one integer: the minimum total time.
Constraints
- ~1 \le n \le 2 \cdot 10^5~
- ~1 \le t\_i \le 10^9~
Example Input
3
2 8 3
Example Output
16
Bình luận