Logo
(追記) (追記ここまで)

32465번 - Hexagonal Tiling 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
4 초 (추가 시간 없음) 1024 MB (추가 메모리 없음)409635.294%

문제

You are given a regular hexagon having sides of length $N$. A regular hexagon can be split into unit equilateral triangles of side length 1ドル$ as shown in the figure below. We are going to completely fill the hexagon with unit rhombuses of side length 1ドル$ formed by joining two equilateral triangles which share an edge.

Hexagon formed from triangles

For each position a unit rhombus can be placed, the cost of placing a rhombus is given. Find the minimum cost required to fill the hexagon.

입력

The first line of input contains $N$.

The following 2ドルN$ lines contain the cost for a rhombus placed in each respective row.

Let’s say the cost of a rhombus formed by joining the $j$-th and $j+1$-th triangles of the $i$-th row is $p_{i,j}$.

The $i$-th of the 2ドルN$ lines of input contains $p_{i,1},p_{i,2},\ldots$.

The next 2ドルN-1$ lines of input contain the cost for a rhombus placed across two rows.

Let’s say the cost of a rhombus formed by joining the $j$-th inverted triangle of the $i$-th row and the triangle above it is $q_{i,j}$.

The $i$-th of the 2ドルN-1$ lines contains $q_{i+1,1},q_{i+1,2},\ldots$.

출력

Print the minimum cost required to fill the hexagon using unit rhombuses. It can be proved that it is always possible to fill a hexagon using unit rhombuses.

제한

  • 1ドル\leq N\leq 100$
  • 0ドル\leq p_{i,j},q_{i,j}\leq 10^9$

예제 입력 1

1
2 3
4 5
1 6

예제 출력 1

9

예제 입력 2

2
3 14 15 9
2 6 5 3 5 8
97 9 3 2 3 8
4 6 26 4
3 3 8
3 2 7 9
5 0 2

예제 출력 2

58

노트

The costs of rhombuses given in example 1

The solution for example 2

출처

University > KAIST > KAIST ICPC Mock Competition > 2024 KAIST 14th ICPC Mock Competition E번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /