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 n, m, x1, y1, x2, y2 — the board sizes and the coordinates of the first and second chips, correspondingly (1 ≤ n, m ≤ 100; 2 ≤ n × m; 1 ≤ x1, x2 ≤ n; 1 ≤ 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.

Examples

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

OJ-ID:
CodeForce 176C

author:
Caution_X

date of submission:
20191012

tags:
easy problem

description modelling:
给定一个棋盘,两个棋子,双方轮流操作,A先走,每次移动一个棋子在相邻格子一格,B后走,每次可以在一个格子涂胶水,如果两个棋子可以重合,A赢,否则B赢

major steps to solve it:
1.如果棋盘“非常大”,可以猜想B一定会赢
2.此时我们讨论A赢得极限情况。
设开始时两个棋子分别在棋盘左上角和右下角,棋盘规模为:
1×5
2×5
3×5
4×4
时A恰好赢,其他情况下A都无法赢

AC code:

#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,m,x1,x2,y1,y2;
scanf("%d%d%d%d%d%d",&n,&m,&x1,&y1,&x2,&y2);
int dmin,dmax;
dmin=min(abs(x1-x2),abs(y1-y2));
dmax=max(abs(x1-x2),abs(y1-y2));
if((dmin==&&dmax<=)||(dmin==&&dmax<=)||(dmin==&&dmax<=)||(dmin==&&dmax<=)) printf("First\n");
else printf("Second\n");
return ;
}

CodeForce 176C Playing with Superglue的更多相关文章

  1. CodeForces 176C Playing with Superglue 博弈论

    Playing with Superglue 题目连接: http://codeforces.com/problemset/problem/176/C Description Two players ...

  2. (转) Playing FPS games with deep reinforcement learning

    Playing FPS games with deep reinforcement learning 博文转自:https://blog.acolyer.org/2016/11/23/playing- ...

  3. Codeforce 546D

    Soldier and Number Game Time Limit:3000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

  4. Codeforce - Street Lamps

    Bahosain is walking in a street of N blocks. Each block is either empty or has one lamp. If there is ...

  5. Codeforce 567D

    One-Dimensional Battle Ships time limit per test 1 second memory limit per test 256 megabytes input ...

  6. (转) Deep Reinforcement Learning: Playing a Racing Game

    Byte Tank Posts Archive Deep Reinforcement Learning: Playing a Racing Game OCT 6TH, 2016 Agent playi ...

  7. Codeforces Round #184 (Div. 2) E. Playing with String(博弈)

    题目大意 两个人轮流在一个字符串上删掉一个字符,没有字符可删的人输掉游戏 删字符的规则如下: 1. 每次从一个字符串中选取一个字符,它是一个长度至少为 3 的奇回文串的中心 2. 删掉该字符,同时,他 ...

  8. ifrog-1028 Bob and Alice are playing numbers(trie树)

    题目链接: Bob and Alice are playing numbers DESCRIPTION Bob and his girl friend are playing game togethe ...

  9. Codeforce Round #216 Div2

    e,还是写一下这次的codeforce吧...庆祝这个月的开始,看自己有能,b到什么样! cf的第二题,脑抽的交了错两次后过了pretest然后system的挂了..脑子里还有自己要挂的感觉,果然回头 ...

随机推荐

  1. KeContextToKframes函数逆向

    在逆向_KiRaiseException(之后紧接着就是派发KiDispatchException)函数时,遇到一个 KeContextToKframes 函数,表面意思将CONTEXT转换为 TRA ...

  2. length()返回当前字符串的字符个数

    package seday01;/** * int length() * 返回当前字符串的字符个数 * @author xingsir * */public class LengthDemo { pu ...

  3. CAD画三维图怎么渲染?一分钟教你快速操作

    从事过CAD相关工作的都知道,CAD绘制的方式有二维平面图以及三维图形,三维图形,画三维图方式也是比较简单的.那当然三维图画完后一般还需要进行渲染操作,步骤也是比较简洁的.下面就来给大家操作一下CAD ...

  4. Linux下 vim代码编译器的使用

    首先在命令行模式下输入代码: vim ok.c 创建c文件 如果发现vim没有被安装的话,输入以下代码对vim进行安装: sudo apt install vim 安装完毕之后再输入第一行代码,之后进 ...

  5. Linux实现免密码登录

    一.验证ssh远程登录,未作免密处理的两台机器,登录时,是需要输入密码的 二.本地系统执行 ssh-keygen -t rsa 命令,生成密钥文件 三.在相应的目录下查看生成的密钥文件,其中:id_r ...

  6. nginx+php+redis+ssl 配置

    php的接触得很少,记录一下 环境:CentOS 7.4 安装软件 # 安装 nginx yum install nginx # 配置PHP7的源,安装 PHP 7.0 及扩展 yum install ...

  7. Odoo12 之主题创建或扩展

    初次使用 Odoo 来制作网站,因Odoo自带代码块效果单一,无法满足当前网站展示效果,需要对当前代码块进行添加或扩展.而这个代码块是属于网站中的布局设计这一块,Odoo 将所有的布局以及逻辑行为,都 ...

  8. 安全类和远程类shell脚本

    批量杀php小马脚本 find /home/hatdot/ -name "*.php" |xargs egrep "phpspy|c99sh|milw0rm|eval\( ...

  9. fiddler---Fiddler抓取https协议

    上一篇简单的介绍了Fiddler的使用方法和页面布局介绍,Fiddler默认抓取的是HTTP协议,现在的协议基本上都是基于HTTPS协议的,今天写一篇如何通过Fiddler抓取HTTPS协议 什么是H ...

  10. Ubuntu18.04连接蓝牙耳机

    使用的耳机是索尼WI-SP500,打开设置,找到Bluetooth,直接连接(WI-SP500在连接第二台设备时,需要长按开机键7秒才行), 保证Output选择需要连接的耳机,然后确保Profile ...