시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB56431524061.069%

문제

부유한 집안의 상속자 상근이네 집은 그림과 같이 1미터의 정육각형이 붙어있는 상태이다. 크리스마스가 다가오기 때문에, 여자친구에게 잘 보이기 위해 상근이는 건물의 벽면을 조명으로 장식하려고 한다. 외부에 보이지 않는 부분에 조명을 장식하는 것은 낭비라고 생각했기 때문에, 밖에서 보이는 부분만 장식하려고 한다.

위의 그림은 상공에서 본 상근이네 집의 건물 배치이다. 정육각형 안의 숫자는 좌표를 나타낸다. 여기서 회색 정육각형은 건물의 위치이고, 흰색은 건물이 없는 곳이다. 위에서 붉은 색 선으로 표시된 부분이 밖에서 보이는 벽이고, 이 벽에 조명을 장식할 것이다. 벽의 총 길이는 64미터이다.

상근이네 집의 건물 위치 지도가 주어졌을 때, 조명을 장식할 벽면의 길이의 합을 구하는 프로그램을 작성하시오. 지도의 바깥은 자유롭게 왕래 할 수 있는 곳이고, 인접한 건물 사이는 통과할 수 없다.

입력

첫째 줄에 두 개의 정수 W와 H가 주어진다. (1 ≤ W, H ≤ 100) 다음 H줄에는 상근이네 집의 건물 배치가 주어진다. i+1줄에는 W개의 정수가 공백으로 구분되어 있다. j번째 (1 ≤ j ≤ w) 정수의 좌표는 (j, i)이며, 건물이 있을 때는 1이고, 없을 때는 0이다. 주어지는 입력에는 건물이 적어도 하나 있다.

지도는 다음과 같은 규칙에 의해 만들어졌다.

  • 지도의 가장 왼쪽 위에 있는 정육각형의 좌표는 (1,1)이다.
  • (x,y)의 오른족에 있는 정육각형의 좌표는 (x+1,y)이다.
  • y가 홀수 일 때, 아래쪽에 있는 정육각형의 좌표는 (x,y+1)이다.
  • y가 짝수 일 때, 오른쪽 아래에 있는 정육각형의 좌표는 (x,y+1)이다.

출력

조명을 장식하는 벽면의 길이의 합을 출력한다.

예제 입력 1

8 4
0 1 0 1 0 1 1 1
0 1 1 0 0 1 0 0
1 0 1 0 1 1 1 1
0 1 1 0 1 0 1 0

예제 출력 1

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1NGY4Ylx1MzA2Ylx1NWJmZVx1NWZkY1x1MzA1N1x1MzA2Nlx1MzA0YVx1MzA4YVx1ZmYwY1x1MzBhNFx1MzBlYlx1MzBkZlx1MzBjZFx1MzBmY1x1MzBiN1x1MzBlN1x1MzBmM1x1MzA2N1x1OThmZVx1MzA4YVx1NGVkOFx1MzA1MVx1MzA5Mlx1ODg0Y1x1MzA0Nlx1NThjMVx1OTc2Mlx1MzA2ZVx1OTU3N1x1MzA1NVx1MzA2ZVx1NTQwOFx1OGEwOFx1MzA2ZiA2NCBcdTMwZTFcdTMwZmNcdTMwYzhcdTMwZWJcdTMwNjdcdTMwNDJcdTMwOGJcdWZmMGU8XC9wPlxyXG4iLCJvcmlnaW5hbCI6IjEiLCJodG1sX3RpdGxlIjoiMCIsInByb2JsZW1fbGFuZ190Y29kZSI6IkphcGFuZXNlIn1d

출처

Olympiad > Japanese Olympiad in Informatics > Japanese Olympiad in Informatics Qualification Round > JOI 2012 예선 5번

  • 문제를 번역한 사람: baekjoon
  • 문제의 오타를 찾은 사람: lein