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

7502번 - Game on Chessboard 다국어

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

문제

There is a chessboard of the size M×N. K fairy chess pieces called (p, q)-leapers (p < q) are placed in some squares on this board. Leaper’s move is similar to a regular chess knight’s move, with some constraints though. When (p, q)-leaper moves, it can move p squares horizontally and qsquares vertically (only upward), or q squares horizontally (only leftward) and p squares vertically. In other words, the move to q squares must be in a direction where corresponding coordinate decreases. Moving outside of the board is prohibited. However several leapers are allowed to occupy the same square.

Two players are playing the game, alternating moves. In his turn a player chooses some leaper and moves it according to the rules. The player who is not able to move any leaper loses the game. Givena board configuration determine the winner, assuming both players play optimally.

입력

The first line of input contains 5 integers: M, N, K, p, q (1M, N109, 1K105, 1p < q20). Each of following K lines contains coordinates riand ciof corresponding leaper (1riM, 1ciN).

출력

The single line of output should contain stringFirst, if the first player wins the game under optimal strategy, andSecondotherwise.

제한

예제 입력 1

10 10 2 1 2
3 7
7 3

예제 출력 1

Second

예제 입력 2

7 5 3 1 3
2 3
1 5
4 3

예제 출력 2

First

힌트

출처

ICPC > Regionals > Europe > Southeastern European Regional Contest > All-Ukrainian Collegiate Programming Contest > AUCPC 2010 L번

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

출처

대학교 대회

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

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