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

6079번 - Checkers 다국어

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

문제

The cows have taken up the game of checkers with a vengeance. Unfortunately, despite their infinite enjoyment of playing, they are terrible at the endgame. They want your help.

Given an NxN (4 <= N <= 30) checkboard, determine the optimal set of moves to end the game on the next move. Checkers move only on the '+' squares and capture by jumping 'over' an opponent's piece. The piece is removed as soon as it is jumped. See the example below where N=8:

- + - + - + - + The K's mark Bessie's kings; the o's represent the
+ - + - + - + - opponent's checkers. Bessie always moves next. The
- + - K - + - + Kings jump opponent's checkers successively in any
+ - + - + - + - diagonal direction (and removes pieces when jumped).
- o - o - + - +
+ - K - + - + - For this board, the solution requires the lower left
- o - + - + - + King to jump successively across all three of the
+ - K - + - K - opponents' checkers, thus ending the game (moving K
 marked as >K<):
 Original After move 1 After move 2 After move 3
- + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
+ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + -
- + - K - + - + - + - K - + - + - + - K - + - + - + - K - + - +
+ - + - + - + - + - + - + - + - + ->K<- + - + - + - + - + - + -
- o - o - + - + - o - o - + - + - + - o - + - + - + - + - + - +
+ - K - + - + - >K<- K - + - + - + - K - + - + - + - K ->K<- + -
- o - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
+ ->K<- + - K - + - + - + - K - + - K - + - K - + - K - + - K -

The moves traversed these squares:

 1 2 3 4 5 6 7 8 R C
1 - + - + - + - + start: 8 3
2 + - + - + - + - move: 6 1
3 - + - K - + - + move: 4 3
4 + - * - + - + - move: 6 5
5 - o - o - + - +
6 * - K - * - + - 
7 - o - + - + - + 
8 + - K - + - K - 

Write a program to determine the (unique, as it turns out) game-ending sequence for an NxN input board if it exists. There is at least a king and at least one opponent piece on the board.

입력

  • Line 1: A single integer: N
  • Lines 2..N+1: Line i+1 contains N characters (each one of: '-', '+', 'K', or 'o') that represent row i of a proper checkboard.

출력

  • Lines 1..?: If this sequence of moves is impossible, output "impossible" on a line by itself. If such a sequence exist, each line contains two space-separated integers that represent successive locations of a king whose moves will win the game.

제한

예제 입력 1

8
-+-+-+-+
+-+-+-+-
-+-K-+-+
+-+-+-+-
-o-o-+-+
+-K-+-+-
-o-+-+-+
+-K-+-K-

예제 출력 1

8 3
6 1
4 3
6 5

힌트

출처

Olympiad > USA Computing Olympiad > 2008-2009 Season > USACO December 2008 Contest > Bronze 1번

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

출처

대학교 대회

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

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