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

J4. Trianglane

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

의견: 0

설명

Bocchi the Builder just finished constructing her latest project: a
laneway consisting of two rows of white equilateral triangular tiles.
However, at the last moment, disaster struck! She accidentally spilled
black paint on some of the tiles. Now, some of the tiles are wet and the
other tiles are dry. Bocchi must place warning tape around the
perimeters of all wet areas. Can you help her determine how many metres
of tape she needs?

The first triangular tile will point upwards. Each pair of adjacent
tiles (that is, tiles that share a common side) will point in opposite
directions. Each tile has a side length of 1 metre.

제약
입력 형식

The first line of input will consist of one positive integer \(C\), representing the number of
columns.

The next two lines will each consist of \(C\) integers separated by spaces. Each
integer represents the colour of a tile along the laneway, with 1
indicating that the tile is black (wet) and 0 indicating that the tile
is white (dry).

출력 형식

Output a single integer representing the length of tape Bocchi needs,
in metres.

서브태스크
서브태스크점수설명

1

20점

The laneway is not very long, black tiles are never adjacent and the second row is fully white. — \(C \le 2\,000\)

2

20점

The laneway is not very long, black tiles may be adjacent and the second row is fully white. — \(C \le 2\,000\)

3

34점

The laneway is not very long, black tiles may be adjacent and may appear in the second row. — \(C \le 2\,000\)

4

26점

The laneway may be very long, black tiles may be adjacent and may appear in the second row. — \(C \le 200\,000\)

예제 1
입력
5
1 0 1 0 1
0 0 0 0 0
출력
9
설명

The tiles are painted as follows, creating three wet areas. Bocchi
will need 9 metres of warning tape as shown in yellow.

예제 2
입력
7
0 0 1 1 0 1 0
0 0 1 0 1 0 0
출력
11
설명

The tiles are painted as follows, creating three wet areas. Bocchi
will need 5 metres of warning tape to surround one area and 3 metres of
warning tape to surround each of the other two areas as shown in
yellow.

문제 정보

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

출처 CCC 2023 Junior

평가 및 의견

J4. Trianglane

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

Log in to rate problems.

개별 의견

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

풀이 제출

J4. Trianglane

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