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

E. Endgame

스페셜 저지 — 출력을 사용자 정의 프로그램으로 검사하므로 여러 정답이 인정될 수 있습니다.
설명

The boardgame Chaos is an exotic variant of Chess, played by two players in alternating turns on an \(n\times n\) playing board. All pieces have the same set of \(n\) valid moves which are agreed on ahead of the game.

In a single turn a player can pick exactly one of their pieces and perform one of the following actions:
- Perform up to two valid moves using the chosen piece, capturing any piece that the chosen piece lands on along the way.
- Teleport the chosen piece to any cell on the board that is not already occupied by another piece.
- Leave the chosen piece untouched in its current cell.

Having recently discovered Chaos, Alice and Bob are currently in the endgame of a very exciting match. Each player has a single piece left on the board and there are only two turns left, with Alice going next.

Having analysed the situation, she realises that the only way she can win is to capture Bob's piece in her turn. If that is not possible, Alice may be able to force a tie if she can teleport her piece to a cell that Bob cannot capture in his turn. Otherwise Bob will be able to win by capturing Alice's piece, no matter what she does in her turn. Help Alice determine her optimal outcome.

제약
입력 형식

The input consists of:
- One line with an integer \(n\) (\(2 \leq n \leq 10^5\)), the size of the playing board and the number of valid moves.
- One line with two integers \(a_x\) and \(a_y\) (\(1 \leq a_x, a_y \leq n\)), the column and row in which Alice's piece is currently located.
- One line with two integers \(b_x\) and \(b_y\) (\(1 \leq b_x, b_y \leq n\)), the column and row in which Bob's piece is currently located.
- \(n\) lines, the \(i\)th of which contains two integers \(x_i\) and \(y_i\) (\(-n < x_i, y_i < n\)) representing one of the valid moves. This moves the given piece \(x_i\) columns to the right and \(y_i\) rows up, provided this does not take the piece outside of the board.

Columns are numbered \(1\) to \(n\) from left to right and rows are numbered \(1\) to \(n\) from bottom to top. All valid moves are distinct.

출력 형식

If Alice can capture Bob's piece in her turn, output "Alice wins".

If Alice can use her turn to force a tie by teleporting her piece to a cell that Bob cannot capture in his turn output "tie" followed by two integers \(a'_x\) and \(a'_y\), the location of any such cell. If there are multiple valid solutions, you may output any one of them.

Otherwise, if Bob is able to capture Alice's piece no matter what she does in her turn, output "Bob wins".

예제 1
입력
2
2 1
1 2
1 0
0 -1
출력
Bob wins
예제 2
입력
3
2 3
1 3
-2 1
1 1
1 0
출력
tie 3 1
예제 3
입력
4
1 1
3 4
0 3
2 0
0 -3
-2 0
출력
Alice wins
문제 정보

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

출처 ICPC NWERC 2020

평가 및 의견

E. Endgame

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

Log in to rate problems.

개별 의견

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

풀이 제출

E. Endgame

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