当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7194:Bragging Dice

题目描述
In the mysterious accient East, there is an ancient dice game - "bragging". Now YahAHa and Peanut is playing bragging.

The rules of the game are as follows:

There are $2$ players in one game. Each player has $n$ dices in the cup. Both players roll the dice once.

Players play in turns. YahAHa start. In the first turn, YahAHa can claim "there are $x(x\geq 1)$ dices with $y(1\leq y\leq 6)$ points in the 2 cups".

Then Peanut has $2$ choices.

1. Challenge YahAHa. If anyone challenges, the game is over . Each player opens its cup. If indeed there are $x$ dices with $y$ points in the cups, YahAHa wins, otherwise Peanut wins.

2. Continue to claim, but can only claim "there are $x_1$ $(x_1>x)$ dices with $y_1(1\leq y_1\leq 6)$ points in the cups" or "there are $x_2$ $(x_2=x)$ dices with $y_2$ $(y_2 > y)$ points in the cups".

After Peanut claimed, YahAHa continued to choose whether to challenge or claim. Both players take turns until someone challenges, then the game is over.

To make the game more interesting, here are some special rules.

1. If no one has claimed that "there are $x$ dices with $1$ point in the cups", the dice with $1$ point can be regarded as any points of dice.

2. If all dices in one cup has the same points, it's considered there is an extra dice with the same points. For example, if there are $5$ dices and $5$ dices are all with $6$ points, it's considered there are $6$ dices with $6$ points.

3. If each dice in one cup has different points, it's considered "there are $0$ dice with any points in the cup". For example, if there are $5$ dices,their points are $1$ point, $2$ points, $3$ points, $4$ points and $5$ points. It's considered "there are $0$ dice with $1$ point in the cup", "there are $0$ dice with $2$ point in the cup", ... , "there are $0$ dice with $5$ point in the cup".

If there is conflict in these three rules, please consider the third special rule first.

YahAHa and Peanut don't like stupid game of chance, so they want to play this game while knowing the points of every dices in the 2 cups.

Given you the points of all dices they roll. YahAHa wants to find out who will win the game if both of them play the game optimally.
输入解释
Each test contains multiple test cases. The first line contains the number of test cases $(1 \le T \le 30)$. Description of the test cases follows.

The first line of the input contains only one integers $n$ $(2\le n \le 2\times 10^5)$ indicating the number of dices.

The next line contains $n$ integers $a_1, a_2, \cdots, a_n$. The $i$-th integer $a_i$ indicating the points of the $i$-th dice from YahAHa.

The next line contains $n$ integers $b_1, b_2, \cdots, b_n$. The $i$-th integer $b_i$ indicating the points of the $i$-th dice from Peanut.


输出解释
For each test case:

If YahAHa wins, print "Win!" in one line; If Peanut wins, print "Just a game of chance." in one line.
输入样例
1
5
4 6 4 1 2
3 6 6 2 3
输出样例
Win!

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7194

最后修改于 2022-09-15T06:17:16+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
4000/2000MS(Java/Others) 65536/524288K(Java/Others)