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

6127번 - Super Paintball 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB75665187.931%

문제

The cows have purchased a Super Paintball Deluxe game set from Tycow, the cow-toy manufacturer. Bessie, knowing you can help, has partitioned the pasture into a set of N x N unit squares (1 <= N <= 100) and compiled a list of the K (1 <= K <= 100,000) locations (1 <= R_i <= N; 1 <= C_i <= N) of every one of her opponents in the Paintball game.

This paintball game features a paintball gun that can shoot paintballs in any of eight directions: north, south, east, west, and the diagonals that split those directions exactly (northeast, southeast, northwest, southwest).

Bessie wants you to tell her the total number of squares she can occupy and still be able to shoot all of her opponents (she can even shoot them if she shares the same square as they occupy!).

입력

  • Line 1: Two space-separated integers: N and K
  • Lines 2..K+1: Line i+1 describes cow i's location with two space-separated integers: R_i and C_i

출력

  • Line 1: A single integer that tells how many different locations Bessie may occupy if she is to be able to shoot any cow according to the shooting rules.

제한

예제 입력 1

4 3
2 1
2 3
4 1

예제 출력 1

5

힌트

The pasture has 4 rows and 4 columns. Bessie needs to shoot cows at (2,1), (2,3), and (4,1):

 . . . .
 C . C . 
 . . . . <--- Cow locations
 C . . .

Bessie can occupy any of these cells: (2,1), (2,3), (3,2), (4,1), and (4,3). The diagram below notates possibly shared spaces by '*':

 .. . . . . . .
 B . B . ---\ * . * .
 . B . . ---/ . B . .
 B . B . * . B .
 Potential Bessie Bessie &amp; Cows
 Locations

출처

Olympiad > USA Computing Olympiad > 2007-2008 Season > USACO October 2007 Contest > Gold 2번

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

출처

대학교 대회

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

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