CodeForces 176C Playing with Superglue(游戏)

题意给你一个n*m的棋盘,第一个人的目的是让两个棋子合在一起,第二个人是阻止两个棋子合在一起,然后给你两个棋子,第一个人先走,然后第二个人在地上涂胶水,涂过胶水的位置棋子踩了上去就不能动了,问你谁能够胜利

思路:游戏题....慢慢找规律...在WA了快十次之后终于找到3 4这种数据


#include<bits/stdc++.h>
using namespace std;

int main()
{
    int n,m,x1,y1,x2,y2;
    cin>>n>>m>>x1>>y1>>x2>>y2;
    int dis1 = abs(x1-x2);
    int dis2 = abs(y1-y2);
    if(dis1>dis2)swap(dis1,dis2);
    if(dis1>4||dis2>4)return puts("Second");
    if(dis1==4&&dis2==4)return puts("Second");
    if(dis1==3&&dis2==4)return puts("Second");
    return puts("First");
}

Description

Two players play a game. The game is played on a rectangular board with n × m squares. At the beginning of the game two different squares of the board have two chips. The first player's goal is to shift the chips to the same square. The second player aims to stop the first one with a tube of superglue.

We'll describe the rules of the game in more detail.

The players move in turns. The first player begins.

With every move the first player chooses one of his unglued chips, and shifts it one square to the left, to the right, up or down. It is not allowed to move a chip beyond the board edge. At the beginning of a turn some squares of the board may be covered with a glue. The first player can move the chip to such square, in this case the chip gets tightly glued and cannot move any longer.

At each move the second player selects one of the free squares (which do not contain a chip or a glue) and covers it with superglue. The glue dries long and squares covered with it remain sticky up to the end of the game.

If, after some move of the first player both chips are in the same square, then the first player wins. If the first player cannot make a move (both of his chips are glued), then the second player wins. Note that the situation where the second player cannot make a move is impossible — he can always spread the glue on the square from which the first player has just moved the chip.

We will further clarify the case where both chips are glued and are in the same square. In this case the first player wins as the game ends as soon as both chips are in the same square, and the condition of the loss (the inability to move) does not arise.

You know the board sizes and the positions of the two chips on it. At the beginning of the game all board squares are glue-free. Find out who wins if the players play optimally.

Input

The first line contains six integers nmx1y1x2y2 — the board sizes and the coordinates of the first and second chips, correspondingly (1 ≤ n, m ≤ 1002 ≤ n × m1 ≤ x1, x2 ≤ n1 ≤ y1, y2 ≤ m). The numbers in the line are separated by single spaces.

It is guaranteed that the chips are located in different squares.

Output

If the first player wins, print "First" without the quotes. Otherwise, print "Second" without the quotes.

Sample Input

Input
1 6 1 2 1 6
Output
First
Input
6 5 4 3 2 1
Output
First
Input
10 10 1 1 10 10
Output
Second


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值