RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00645

Zrinka

Unrated 레이팅 미적용
난이도
1s
시간 제한
512MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 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.

예제 1
입력
0
4 1 0 1 1
출력
5
예제 2
입력
4 0 1 0 1
4 1 0 0 1
출력
9
예제 3
입력
5 0 1 0 0 1
4 0 0 0 1
출력
13
설명

Clarification 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).

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2022/2023 Contest 4

평가 및 의견

Zrinka

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Zrinka

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8