logo AlgoBeat OnlineJudge
登录 注册

#212183. [OOI 2025] Card Flip

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Petya and Vasya bought a new card game called ''Flip''. The game contains double-sided cards and single-sided cards:

  • The front side of the card has the number , and the back side has the number .
  • The front side of the card has a single number .

All numbers written on the cards on all sides are distinct. Initially, all cards are placed on the table with the front side up. On his turn, a player can perform exactly one of two actions:

  • Remove from the table the card with the smallest number among the remaining cards.
  • If the card with the smallest number is double-sided and facing up, it can be flipped.

The player who removes the last card from the table wins. Determine the winner of the game if Petya goes first.

输入格式

The first line contains two integers and () --- the number of double-sided and single-sided cards, respectively.

The second line contains integers , , , () --- the numbers written on the front side of the double-sided cards.

The third line contains integers , , , () --- the numbers written on the back side of the double-sided cards.

The fourth line contains integers , , , () --- the numbers written on the single-sided cards.

It is guaranteed that each number from to appears exactly once in one of the arrays , , or .

输出格式

Print First if Petya wins in this game, and Second if Vasya wins.

样例

样例输入 1

2 1
5 3
1 2
4

样例输出 1

First

样例输入 2

1 2
2
3
4 1

样例输出 2

Second

数据范围与提示

Note

In the first example, initially, the cards 3, 4, and 5 are on the table. To win, Petya discards card 3 on his turn, after which Vasya must discard card 4, as it is single-sided. Finally, Petya discards card 5, meaning there will be no cards left for Vasya, and Petya wins.

In the second example, initially, the cards 1, 2, and 4 are on the table. Petya must discard the first card, as it is single-sided. Then, to win, Vasya flips card 2, so there will be cards 3 and 4 on the table. Petya must discard the flipped card number 3, after which Vasya will discard card 4. Since the cards will run out, Vasya will win.

Scoring

The tests for this problem consist of nine groups. Points for each group are given only if all tests of the group and all tests of the required groups are passed. Please note that passing the example tests is not required for some groups. means that the results of testing your solution on this group will only be available after the end of the competition.

Group Points Additional constraints: Additional constraints: Required Groups Comment
0 -- Examples.
1 12 0
2 13 -- 0, 1
3 9 -- --
4 10
5 6 The segments do not intersect.
6 11 The segments are nested or do not intersect.
7 14 -- 5, 6
8 13 0, 1, 6
9 12 -- 0 -- 8 Offline-evaluation.