Zrinka
의견: 0
You are given two arrays of length \(n\) and \(m\) respectively, which consist only of 0’s
and 1’s.
Your task is to replace every zero with an even positive integer and every one with
an odd positive integer. After replacements both arrays should be increasing and
you can use each postive integers at most once.
As this would be to easy, you are asked to do it such that the largest number you
use is as small as possible.
Given two arrays, output the minimum possible largest number that needs to be used.
Subtask 1 (15 points): \(n = 0\)
Subtask 2 (20 points): The first array consists only of 0’s.
Subtask 3 (15 points): n, \(m \le 500\)
Subtask 4 (20 points): No additional constraints.
The first array is of length \(n\) (\(0 \le n \le 5\,000\)), the second is of length \(m\) (\(1 \le m \le 5\,000\)).
The first line consists of \(n + 1\) integers, first being \(n\), and others describing the first array.
The second line consists of \(m + 1\) integers, first being \(m\), and others describing the second array.
The first and only line should contain a positive integer, the answer to the question above.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
1 | 15점 | \(n = 0\) |
2 | 20점 | The first array consists only of 0’s. |
3 | 15점 | n, \(m \le 500\) |
4 | 20점 | No additional constraints. |
0
4 1 0 1 154 0 1 0 1
4 1 0 0 195 0 1 0 0 1
4 0 0 0 113Clarification of the second example:
One of the possible solutions is (2, 3, 4, 5) and (1, 6, 8, 9).
Clarification of the third example:
One of the possible solutions is (2, 3, 6, 8, 9) and (4, 10, 12, 13).
평가 및 의견
Zrinka
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Zrinka