시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 512 MB | 265 | 84 | 77 | 31.429% |
In the third semester of the first grade of JOI High School, $N$ courses are given for $M$ weeks from the first week to the $M$-th week. The courses are numbered from $1$ to $N$. In each week, $N$ classes are given. The $i$-th class in each week is a class for Course $i$.
Bitaro is a student of the first grade. In each of the $N \times M$ classes, he takes one of the following actions.
In the beginning, the comprehension level of every course is $0$. Since Bitaro wants to practice competitive programming after school, he will not study outside the duration of the classes. When all the classes in the third semester finish, the final examination will be held.
Bitaro does not want to get a failing grade. Therefore, he wants to maximize the minimum comprehension level of the courses at the moment of the final examination.
Given the length of the semester, the number of the courses, and the incremental values of the comprehension levels, write a program which calculates the maximum possible value of the minimum comprehension level of the courses at the moment of the final examination.
Read the following data from the standard input. Given values are all integers.
$\begin{align*} & N\,M \\ & A_1 \, A_2 \, \cdots \, A_N \\ & B_1 \, B_2 \, \cdots \, B_N\end{align*}$
Write one line to the standard output. The output should contain the maximum possible value of the minimum comprehension level of the courses at the moment of the final examination.
번호 | 배점 | 제한 |
---|---|---|
1 | 10 | $M = 1$. |
2 | 25 | $N \times M ≤ 300\,000$, $A_i = B_i$ ($1 ≤ i ≤ N$). |
3 | 27 | $N \times M ≤ 300\,000$. |
4 | 29 | $A_i = B_i$ ($1 ≤ i ≤ N$). |
5 | 9 | No additional constraints. |
3 3 19 4 5 2 6 2
18
For example, if Bitaro studies in the following way, the compehension level of Course $1$, $2$, $3$ will be $19$, $18$, $19$, respectively.
Since the minimum comprehension level of the courses cannot be larger than or equal to $19$, output $18$. This sample input satisfies the constraints of Subtasks 3, 5.
2 1 9 7 2 6
7
This sample input satisfies the constraints of Subtasks 1, 3, 5.
5 60000 630510219 369411957 874325200 990002527 567203997 438920902 634940661 593780254 315929832 420627496
41397427274960
This sample input satisfies the constraints of Subtasks 3, 5.
4 25 1 2 3 4 1 2 3 4
48
This sample input satisfies the constraints of Subtasks 2, 3, 4, 5.